-
Notifications
You must be signed in to change notification settings - Fork 825
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
How openai stores my custom session window and can get a list of it. #559
Comments
To implement the function:
Need to achieve:
I looked for a long time in the openai library, but did not find these features to be implemented, perhaps I did not observe carefully enough.🤔import OpenAI from "openai";
export const openai = new OpenAI({
apiKey: "xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx,
dangerouslyAllowBrowser: true,
maxRetries: 0
});
export const useOpenaiChat = () => {
const completions = async () => {
return await openai.chat.completions.create({
model: "gpt-3.5-turbo-1106",
messages: [{ "role": "user", "content": "Say this is a test" }],
stream: true,
frequency_penalty: 1
});
}
return {
completions
}
} import { useOpenaiChat } from "@renderer/hooks";
import { APIError } from "openai";
const openai_chat = useOpenaiChat();
const stream = await openai_chat
.completions()
.catch(({ error: { message } }: APIError) => {
console.log(message);
});
if (stream) {
for await (const chunk of stream) {
console.log(chunk.choices[0]?.delta?.content || "");
}
} OSWindows10 x86 Node versionv16.20.2 Library versionopenai ^4.20.1 |
Hey, not sure what you are asking for exactly here, please post questions like this on https://community.openai.com! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Confirm this is a feature request for the Node library and not the underlying OpenAI API.
Describe the feature or improvement you're requesting
I want the message to create a new session window and store it in openai so I can view it the next time I log in.
Additional context
No response
The text was updated successfully, but these errors were encountered: