Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion example/convex/_generated/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,55 @@ export declare const components: {
boolean
>;
};
coreMemories: {
append: FunctionReference<
"mutation",
"internal",
{ field: "persona" | "human"; text: string; userId?: string },
null
>;
create: FunctionReference<
"mutation",
"internal",
{ human?: string; persona?: string; userId?: string },
string
>;
get: FunctionReference<"query", "internal", { userId?: string }, any>;
insert: FunctionReference<
"mutation",
"internal",
{
field: "persona" | "human";
index: number;
text: string;
userId?: string;
},
null
>;
prepend: FunctionReference<
"mutation",
"internal",
{ field: "persona" | "human"; text: string; userId?: string },
null
>;
remove: FunctionReference<
"mutation",
"internal",
{
field: "persona" | "human";
index: number;
length: number;
userId?: string;
},
null
>;
update: FunctionReference<
"mutation",
"internal",
{ human?: string | null; persona?: string | null; userId?: string },
null
>;
};
files: {
addFile: FunctionReference<
"mutation",
Expand Down Expand Up @@ -838,7 +887,7 @@ export declare const components: {
"mutation",
"internal",
{ messageIds: Array<string> },
Array<string>
any
>;
deleteByOrder: FunctionReference<
"mutation",
Expand Down
Empty file added example/convex/agents/memory.ts
Empty file.
8 changes: 7 additions & 1 deletion example/convex/modelsForDemo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import type { LanguageModelV2 } from "@ai-sdk/provider";
import { openai } from "@ai-sdk/openai";
import { groq } from "@ai-sdk/groq";
import { mockModel } from "@convex-dev/agent";
import { google } from "@ai-sdk/google";

let languageModel: LanguageModelV2;
let textEmbeddingModel: EmbeddingModel<string>;

if (process.env.OPENAI_API_KEY) {
languageModel = openai.chat("gpt-4o-mini");
textEmbeddingModel = openai.textEmbeddingModel("text-embedding-3-small");
} else if (process.env.GROQ_API_KEY) {
languageModel = groq.languageModel(
"meta-llama/llama-4-scout-17b-16e-instruct",
Expand All @@ -24,5 +24,11 @@ if (process.env.OPENAI_API_KEY) {
);
}

if (process.env.OPENAI_API_KEY) {
textEmbeddingModel = openai.textEmbeddingModel("text-embedding-3-small");
} else if (process.env.GOOGLE_GENERATIVE_AI_API_KEY) {
textEmbeddingModel = google.textEmbedding("gemini-embedding-001");
}

// If you want to use different models for examples, you can change them here.
export { languageModel, textEmbeddingModel };
34 changes: 34 additions & 0 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"lint": "tsc -p convex && eslint convex"
},
"dependencies": {
"@ai-sdk/google": "^2.0.14",
"@ai-sdk/groq": "^2.0.0",
"@ai-sdk/openai": "^2.0.0",
"@ai-sdk/provider": "^2.0.0",
Expand Down
Loading