CleoPatra
CleoPatra3w ago

Trying to use the new Ai Agent Error

Hey im trying to use the ai agent that was just posted but im probably missing something because straight away im getting this error: code: const supportAgent = new Agent(components.agent, { thread: openai.chat("gpt-4o-mini"), textEmbedding: openai.embedding("text-embedding-3-small"), instructions: "You are a helpful assistant.", }); error on components.agent: Argument of type '{ messages: { addMessages: FunctionReference<"mutation", "internal", { agentName?: string | undefined; embeddings?: { dimension: 128 | 256 | 512 | 768 | 1024 | 1536 | 2048 | 3072 | 4096; model: string; vectors: (number[] | null)[]; } | undefined; ... 7 more ...; userId?: string | undefined; }, { ...; }>; ... 15 more...' is not assignable to parameter of type '{ [x: string]: { [x: string]: FunctionReference<any, "internal", any, any, string | undefined>; }; }'. Property 'vector' is incompatible with index signature. Type '{ index: { deleteBatch: FunctionReference<"mutation", "internal", { ids: string[]; }, null>; deleteBatchForThread: FunctionReference<"mutation", "internal", { cursor?: string | undefined; limit: number; model: string; threadId: string; vectorDimension: 128 | ... 7 more ... | 4096; }, { ...; }>; insertBatch: Function...' is not assignable to type '{ [x: string]: FunctionReference<any, "internal", any, any, string | undefined>; }'. Property 'index' is incompatible with index signature. Type '{ deleteBatch: FunctionReference<"mutation", "internal", { ids: string[]; }, null>; deleteBatchForThread: FunctionReference<"mutation", "internal", { cursor?: string | undefined; limit: number; model: string; threadId: string; vectorDimension: 128 | ... 7 more ... | 4096; }, { ...; }>; insertBatch: FunctionReference...' is missing the following properties from type 'FunctionReference<any, "internal", any, any, string | undefined>': _type, _visibility, _args, _returnType, _componentPath
10 Replies
Convex Bot
Convex Bot3w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
DogPawHat
DogPawHat3w ago
I'm getting the same error
erquhart
erquhart3w ago
It's a type issue, as a workaround you can do: new Agent(components.agent as any, {...})
CleoPatra
CleoPatraOP3w ago
i found the fix in the example in the tsconfig you need to add this: "customConditions": ["@convex-dev/component-source"] but then i get another error where it doesnt let me do this: thread: openai.chat("gpt-4o-mini"), i mange to work whith changing the thread to chat but not sure that its ok
erquhart
erquhart3w ago
Don't use the custom conditions resolver in your app, that's specifically for component examples Using as any should do the trick for now until a proper fix is in place
CleoPatra
CleoPatraOP3w ago
ok thank you what about the thread?
erquhart
erquhart3w ago
What do you mean?
CleoPatra
CleoPatraOP3w ago
in the doc it says to do this: thread: openai.chat("gpt-4o-mini"), but i get this error: Object literal may only specify known properties, and 'thread' does not exist in type '{ name?: string | undefined; chat: LanguageModelV1; textEmbedding?: EmbeddingModelV1<string> | undefined; instructions?: string | undefined; tools?: ToolSet | undefined; contextOptions?: ContextOptions | undefined; maxSteps?: number | undefined; }'.ts(2353) i solved it with changing thread to chat im just not sure my fix is ok. (i do manage to get results so maybe yes)
erquhart
erquhart3w ago
Oh, chat was renamed to threads a couple days ago, if you update it'll work with threads
CleoPatra
CleoPatraOP3w ago
Awesome thanks

Did you find this page helpful?