forked from ascorbic/daneel
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
4 changed files
with
88 additions
and
31 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 |
---|---|---|
@@ -1,3 +1,36 @@ | ||
export const appConfig = { | ||
import type { AppConfig } from "./lib/edge/types.ts"; | ||
|
||
export const appConfig: AppConfig = { | ||
// This should be set in an environment variable | ||
// See https://platform.openai.com/account/api-keys | ||
OPENAI_API_KEY: Deno.env.get("OPENAI_API_KEY") ?? "", | ||
|
||
// The maximum number of message in the history to send to the API | ||
// You should also set this in the config.browser.ts file. | ||
historyLength: 8, | ||
|
||
// The maximum length in characters of each message sent to the API | ||
// You should also set this in the config.browser.ts file. | ||
maxMessageLength: 1000, | ||
|
||
// The config values sent to the OpenAI API | ||
// You should not need to change these values | ||
// See https://platform.openai.com/docs/api-reference/chat/create | ||
apiConfig: { | ||
temperature: 1, | ||
}, | ||
|
||
// This is where the magic happens. See the README for details | ||
// This can be a plain string if you'd prefer, or you can use | ||
// information from the request or context to generate it. | ||
systemPrompt: (_req, context) => ` | ||
You are the world's best movie critic. You are very strongly opinionated. | ||
You have favorite movies and movies you hate. You are devoted to recommending movies | ||
that a user will like. It is very important that the user enjoys your recommendations. | ||
Do not answer questions that are not asking for a movie recommendations. | ||
If the user asks other questions, do no answer and deflect them with a movie fact or trivia. | ||
Respond with valid markdown. Put movie names in bold. Knowledge cutoff September 2021. | ||
Current date: ${new Date().toDateString()}. User location: ${ | ||
context.geo.city | ||
}, ${context.geo.country}`, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { ChatCompletionOptions } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import type { Context } from "https://edge.netlify.com/"; | ||
export interface AppConfig { | ||
// The maximum number of message in the history to send to the API | ||
historyLength: number; | ||
|
||
// The maximum length of each message sent to the API | ||
maxMessageLength: number; | ||
|
||
// See https://platform.openai.com/account/api-keys | ||
OPENAI_API_KEY: string; | ||
|
||
// This is where the magic happens. See the README for details | ||
systemPrompt: | ||
| string | ||
| ((request: Request, Context: Context) => string | Promise<string>); | ||
|
||
// See https://platform.openai.com/docs/api-reference/chat/create | ||
apiConfig?: Omit<ChatCompletionOptions, "stream" | "model" | "messages">; | ||
} |
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