@convex-dev/agent 0.1.15-alpha.0 → 0.1.15-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +13 -12
  2. package/dist/client/index.d.ts +494 -173
  3. package/dist/client/index.d.ts.map +1 -1
  4. package/dist/client/index.js +148 -170
  5. package/dist/client/index.js.map +1 -1
  6. package/dist/client/listMessages.d.ts +22 -0
  7. package/dist/client/listMessages.d.ts.map +1 -0
  8. package/dist/client/listMessages.js +25 -0
  9. package/dist/client/listMessages.js.map +1 -0
  10. package/dist/client/search.d.ts +162 -0
  11. package/dist/client/search.d.ts.map +1 -0
  12. package/dist/client/search.js +113 -0
  13. package/dist/client/search.js.map +1 -0
  14. package/dist/client/streaming.d.ts +17 -3
  15. package/dist/client/streaming.d.ts.map +1 -1
  16. package/dist/client/streaming.js +32 -0
  17. package/dist/client/streaming.js.map +1 -1
  18. package/dist/client/types.d.ts +5 -1
  19. package/dist/client/types.d.ts.map +1 -1
  20. package/dist/component/_generated/api.d.ts +2 -2
  21. package/dist/component/messages.d.ts +3 -3
  22. package/dist/component/messages.d.ts.map +1 -1
  23. package/dist/component/messages.js +12 -7
  24. package/dist/component/messages.js.map +1 -1
  25. package/dist/component/vector/index.js +3 -3
  26. package/dist/component/vector/index.js.map +1 -1
  27. package/dist/react/optimisticallySendMessage.d.ts +1 -0
  28. package/dist/react/optimisticallySendMessage.d.ts.map +1 -1
  29. package/dist/react/optimisticallySendMessage.js +8 -1
  30. package/dist/react/optimisticallySendMessage.js.map +1 -1
  31. package/dist/react/toUIMessages.d.ts +1 -0
  32. package/dist/react/toUIMessages.d.ts.map +1 -1
  33. package/dist/react/toUIMessages.js +2 -0
  34. package/dist/react/toUIMessages.js.map +1 -1
  35. package/dist/validators.d.ts +41 -52
  36. package/dist/validators.d.ts.map +1 -1
  37. package/dist/validators.js +1 -8
  38. package/dist/validators.js.map +1 -1
  39. package/package.json +6 -4
  40. package/src/client/index.ts +283 -274
  41. package/src/client/listMessages.ts +38 -0
  42. package/src/client/search.ts +172 -0
  43. package/src/client/streaming.ts +49 -2
  44. package/src/client/types.ts +5 -1
  45. package/src/component/_generated/api.d.ts +2 -2
  46. package/src/component/messages.ts +13 -7
  47. package/src/component/vector/index.ts +4 -4
  48. package/src/react/optimisticallySendMessage.ts +11 -1
  49. package/src/react/toUIMessages.ts +3 -0
  50. package/src/validators.ts +2 -10
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/@convex-dev%2fagent.svg)](https://badge.fury.io/js/@convex-dev%2fagent)
4
4
 
5
+ ```sh
6
+ npm i @convex-dev/agent
7
+ ```
5
8
  <!-- START: Include on https://convex.dev/components -->
6
9
 
7
10
  AI Agent framework built on Convex.
@@ -19,23 +22,27 @@ AI Agent framework built on Convex.
19
22
  Enables long-lived, durable workflows defined as code.
20
23
  - Reactive & realtime updates from asynchronous functions / workflows.
21
24
  - Support for streaming text and storing the final result.
22
- See [examples/chat-streaming](./examples/chat-streaming/README.md).
25
+ See [chat/chat-streaming](./example/convex/chat/README.md).
23
26
  - Rate limiting for chat messages and token usage via the
24
27
  [Rate Limiter component](https://convex.dev/components/rate-limiter).
25
- See [examples/rate-limiting](./examples/rate-limiting/README.md).
28
+ See [examples/rate-limiting](./example/convex/rate_limiting/README.md).
26
29
  - Optionally filter tool calls out of the thread history.
27
30
 
28
31
  [Read the associated Stack post here](https://stack.convex.dev/ai-agents).
29
32
 
30
33
  [![Powerful AI Apps Made Easy with the Agent Component](https://thumbs.video-to-markdown.com/b323ac24.jpg)](https://youtu.be/tUKMPUlOCHY)
31
34
 
32
- Play with the [examples](./examples/) by cloning this repo and running:
35
+ Play with the [example](./example/) by cloning this repo and running:
36
+
33
37
  ```sh
38
+ npm run setup
34
39
  npm run example
35
40
  ```
36
41
 
37
42
  ## Example usage:
38
43
 
44
+ See example usage in [example/convex](./example/convex).
45
+
39
46
  ```ts
40
47
  // Define an agent similarly to the AI SDK
41
48
  const supportAgent = new Agent(components.agent, {
@@ -283,8 +290,8 @@ function MyComponent({ threadId }: { threadId: string }) {
283
290
  }
284
291
  ```
285
292
 
286
- See [examples/chat-basic](./examples/chat-basic) for an example, and
287
- [examples/chat-streaming](./examples/chat-streaming) for a streaming example.
293
+ See [ChatBasic.tsx](./example/ui/ChatBasic.tsx) for an example, and
294
+ [ChatStreaming.tsx](./example/ui/ChatStreaming.tsx) for a streaming example.
288
295
 
289
296
  ### Configuring the context of message generation
290
297
 
@@ -558,7 +565,7 @@ export const supportAgentWorkflow = workflow.define({
558
565
  });
559
566
  ```
560
567
 
561
- See another example in [example.ts](./example/convex/example.ts#L120).
568
+ See another example in [workflows/chaining.ts](./example/convex/workflows/chaining.ts).
562
569
 
563
570
  ## Extra control: how to do more things yourself
564
571
 
@@ -638,12 +645,6 @@ const ids = await ctx.runMutation(
638
645
  );
639
646
  ```
640
647
 
641
- See example usage in [example.ts](./example/convex/example.ts).
642
- Read more in [this Stack post](https://stack.convex.dev/ai-agents).
643
-
644
- ```sh
645
- npm i @convex-dev/agent
646
- ```
647
648
 
648
649
  ### Tracking token usage
649
650