Skip to content

Commit dcbc191

Browse files
committed
readme links
1 parent b4099cf commit dcbc191

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ AI Agent framework built on Convex.
99
- Automatic storage of chat history, per-user or per-thread.
1010
- RAG for chat context, via hybrid text & vector search, with configuration options.
1111
Or use the API to query the history yourself and do it your way.
12-
- Opt-in search for messages from other threads (for the same specifieduser).
12+
- Opt-in search for messages from other threads (for the same specified user).
1313
- Tool calls via the AI SDK, along with Convex-specific helpers.
1414
- Easy workflow integration with the [Workflow component](https://convex.dev/components/workflow).
1515
- Reactive & realtime updates to asynchronous threads.
1616
- Support for streaming text and storing the result in the database.
1717
- Optionally filter tool calls out of the thread history.
1818

19+
[Read the associated Stack post here](https://stack.convex.dev/ai-agents).
20+
1921
Example usage:
2022

2123
```ts
@@ -31,7 +33,7 @@ const supportAgent = new Agent(components.agent, {
3133
export const createThread = action({
3234
args: { prompt: v.string() },
3335
handler: async (ctx, { prompt }) => {
34-
const { threadId, thread } = await supportAgent.createThread(ctx, {});
36+
const { threadId, thread } = await supportAgent.createThread(ctx);
3537
const result = await thread.generateText({ prompt });
3638
return { threadId, text: result.text };
3739
},
@@ -68,7 +70,7 @@ export const supportAgentWorkflow = workflow.define({
6870
});
6971
```
7072

71-
Also see the [Stack article](https://stack.convex.dev/ai-agent).
73+
Also see the [Stack article](https://stack.convex.dev/ai-agents).
7274

7375
Coming soon:
7476

@@ -333,7 +335,7 @@ const messages = await ctx.runQuery(components.agent.embeddings.deleteBatch, {
333335
```
334336

335337
See example usage in [example.ts](./example/convex/example.ts).
336-
Read more in [this Stack post](https://stack.convex.dev/ai-agent).
338+
Read more in [this Stack post](https://stack.convex.dev/ai-agents).
337339

338340
```sh
339341
npm i @convex-dev/agent

example/convex/ideaAgents.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vMessageDoc } from "./../../src/component/messages";
21
import { action, ActionCtx, query } from "./_generated/server";
32
import { api, components } from "./_generated/api";
43
import { Agent } from "@convex-dev/agent";
@@ -7,7 +6,6 @@ import { openai } from "@ai-sdk/openai";
76

87
import { createTool } from "@convex-dev/agent";
98
import { Doc, Id } from "./_generated/dataModel";
10-
import { Message } from "../../src/validators";
119
import { MessageDoc } from "../../src/client/types";
1210

1311
/**

src/client/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class Agent<AgentTools extends ToolSet> {
116116
*/
117117
async createThread(
118118
ctx: RunActionCtx,
119-
args: {
119+
args?: {
120120
/**
121121
* The userId to associate with the thread. If not provided, the thread will be
122122
* anonymous.
@@ -152,7 +152,7 @@ export class Agent<AgentTools extends ToolSet> {
152152
*/
153153
async createThread(
154154
ctx: RunMutationCtx,
155-
args: {
155+
args?: {
156156
userId?: string;
157157
parentThreadIds?: string[];
158158
title?: string;
@@ -163,7 +163,7 @@ export class Agent<AgentTools extends ToolSet> {
163163
}>;
164164
async createThread(
165165
ctx: RunActionCtx | RunMutationCtx,
166-
args: {
166+
args?: {
167167
userId: string;
168168
parentThreadIds?: string[];
169169
title?: string;
@@ -177,18 +177,18 @@ export class Agent<AgentTools extends ToolSet> {
177177
this.component.messages.createThread,
178178
{
179179
defaultSystemPrompt: this.options.instructions,
180-
userId: args.userId,
181-
title: args.title,
182-
summary: args.summary,
183-
parentThreadIds: args.parentThreadIds,
180+
userId: args?.userId,
181+
title: args?.title,
182+
summary: args?.summary,
183+
parentThreadIds: args?.parentThreadIds,
184184
}
185185
);
186186
if (!("runAction" in ctx)) {
187187
return { threadId: threadDoc._id };
188188
}
189189
const { thread } = await this.continueThread(ctx, {
190190
threadId: threadDoc._id,
191-
userId: args.userId,
191+
userId: args?.userId,
192192
});
193193
return {
194194
threadId: threadDoc._id,

0 commit comments

Comments
 (0)