-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add temperature option to OpenAI API #288
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
scripts/konjacbot/utils.mts
Outdated
@@ -240,7 +240,8 @@ export function createLogger(prefix: string) { | |||
* @returns {(prompt: { system: string; user: string }) => Promise<string>} A function that takes a prompt and returns the assistant's response as a string. | |||
*/ | |||
export function createOpenAIClient( | |||
openai: OpenAI | |||
openai: OpenAI, | |||
options: { temperature?: number } = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!
optionsは、templerature
だけでなく他のパラメータも将来的に追加する必要性が出てくる可能性があるため、templerature
以外のパラメータもとれるようにしておきたいです。
openai.chat.completions.create
の引数のオブジェクトtypeから、messages
を Omitしたものを設定できるようにしておきませんか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
指摘ありがとうございます!
openai.chat.completions.create の引数のオブジェクトtypeから、messages を Omitしたものを設定できるようにしておきませんか?
openai.chat.completions.create
の引数のオブジェクトtypeであるOpenAI.ChatCompletionCreateParams
からmessage
をOmitし、openai.chat.completions.create
で...options
として展開するようにしました。
また、併せてmodel
もoptions
に持たせるようにしました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pr.mts
内のcreateOpenAIClient
にもmodel
オプションを付け加えられるように修正しました。
翻訳結果のブレを少なくするためにChatGPT APIのオプションに
temperature = 0
のオプションを追加した。