Skip to content

Commit

Permalink
feat: add and update model aliases for Agent and Memory 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 13, 2024
1 parent 2e9ade5 commit 8270c9a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/src/content/docs/reference/scripts/model-aliases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ By default, GenAIScript supports the following model aliases:
- `large`: `gpt-4o like` model
- `small`: `gpt-4o-mini` model or similar. A smaller, cheaper faster model
- `vision`: `gpt-4o-mini`. A model that can analyze images

The following aliases are also set so that you can override LLMs used by GenAIScript itself.

- `agent`: `large`. Model used by the Agent LLM.
- `memory`: `small`. Moel used by the agent short term memory.
4 changes: 4 additions & 0 deletions packages/cli/src/nodehost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {
MODEL_PROVIDER_AZURE_SERVERLESS_OPENAI,
DOT_ENV_FILENAME,
DEFAULT_VISION_MODEL,
LARGE_MODEL_ID,
SMALL_MODEL_ID,
} from "../../core/src/constants"
import { tryReadText } from "../../core/src/fs"
import {
Expand Down Expand Up @@ -154,6 +156,8 @@ export class NodeHost implements RuntimeHost {
small: { model: DEFAULT_SMALL_MODEL, source: "default" },
vision: { model: DEFAULT_VISION_MODEL, source: "default" },
embeddings: { model: DEFAULT_EMBEDDINGS_MODEL, source: "default" },
agent: { model: LARGE_MODEL_ID, source: "default" },
memory: { model: SMALL_MODEL_ID, source: "default" },
},
cli: {},
env: {},
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export async function agentQueryMemory(
await defMemory(_)
},
{
model: "small",
system: ["system"],
model: "memory",
system: [],
flexTokens: 20000,
label: "agent memory query",
}
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/runpromptcontext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function createChatTurnGenerationContext(
cacheControl: (cc) => {
current.ephemeral = cc === "ephemeral"
return res
}
},
} satisfies PromptTemplateString)
return res
},
Expand Down Expand Up @@ -496,6 +496,7 @@ export function createChatGenerationContext(
})
},
{
model: "agent",
label: agentLabel,
system: agentSystem,
tools: agentTools.map(({ id }) => id),
Expand Down

0 comments on commit 8270c9a

Please sign in to comment.