Created
April 26, 2023 15:06
-
-
Save tonyOreglia/6a380c1c74a26e58499a254c4911d6db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let axios = require('axios'); | |
| const openAiApi = axios.create({ | |
| baseURL: 'https://api.openai.com/v1/', | |
| headers: { | |
| Authorization: `Bearer ${gptKey}`, | |
| 'Content-Type': 'application/json' | |
| } | |
| }); | |
| exports.handler = async (event) => { | |
| // ... ommitted | |
| const result = await Api.post('/chat/completions', { | |
| model: 'gpt-3.5-turbo', | |
| messages: [ | |
| { | |
| role: 'system', | |
| content: | |
| 'Act as a therapist with expertise in various fields related to human health and wellness. Your goal is to promote growth and well-being. I am going to provide some of my own journal entries. Then, I will ask a question. Please provide an answer based on the context from the journal entries I have provided.' | |
| }, | |
| { | |
| role: 'user', | |
| content: 'I have always felt heights to be very scary' | |
| }, | |
| { | |
| role: 'user', | |
| content: 'I am afraid of dogs' | |
| }, | |
| { | |
| role: 'user', | |
| content: 'What am I afraid of?' | |
| } | |
| ] | |
| }); | |
| // ...ommitted | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment