-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb18f96
commit 4fc61b8
Showing
4 changed files
with
22 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ Description soon | |
|
||
* React | ||
* React Router | ||
* OpenAI API | ||
* JS | ||
* Sass | ||
* Joy UI | ||
* OpenAI API | ||
* Material Icons |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
import {Configuration, OpenAIApi} from 'openai' | ||
|
||
const configuration = new Configuration() ({ | ||
const configuration = new Configuration({ | ||
apiKey: import.meta.env.VITE_OPENAI_API_KEY | ||
}) | ||
}) | ||
const openai = new OpenAIApi(configuration) | ||
|
||
export async function sendMessage(message) { | ||
const response = await openai.createCompletion({ | ||
model: 'text-davinci-002', | ||
prompt: message, | ||
temperature: 0.5, // how creative OpenAi should be (0 - 1) | ||
max_tokens: 400, | ||
frequency_penalty: 0.01, // parametr frequency_penalty pozwala sterować różnorodnością generowanego tekstu przez model GPT, modyfikując rozkład prawdopodobieństwa, aby rzadziej generować słowa, które model częściej widział podczas treningu. | ||
presense_penalty: 0.01, // parametr presence_penalty zniechęca model GPT do generowania słów, które już wystąpiły w tekście wejściowym (input), poprzez modyfikację rozkładu prawdopodobieństwa. | ||
top_p: 1, // shrinks or grows the “pool” of available tokens to choose from, the domain to select over. 1=big pool, 0=small pool | ||
}) | ||
return response.data.choices[0].text | ||
} |