@weaviate/agents 0.0.0-stage → 1.8.0

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 (35) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +130 -2
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1 -0
  5. package/dist/query/agent.d.ts +539 -0
  6. package/dist/query/agent.js +373 -0
  7. package/dist/query/agent.test.d.ts +1 -0
  8. package/dist/query/agent.test.js +1118 -0
  9. package/dist/query/collection.d.ts +22 -0
  10. package/dist/query/collection.js +12 -0
  11. package/dist/query/connection.d.ts +10 -0
  12. package/dist/query/connection.js +19 -0
  13. package/dist/query/filter.d.ts +2 -0
  14. package/dist/query/filter.js +20 -0
  15. package/dist/query/index.d.ts +4 -0
  16. package/dist/query/index.js +3 -0
  17. package/dist/query/media.d.ts +25 -0
  18. package/dist/query/media.js +24 -0
  19. package/dist/query/response/api-response-mapping.d.ts +3 -0
  20. package/dist/query/response/api-response-mapping.js +172 -0
  21. package/dist/query/response/api-response.d.ts +219 -0
  22. package/dist/query/response/api-response.js +1 -0
  23. package/dist/query/response/error.d.ts +6 -0
  24. package/dist/query/response/error.js +34 -0
  25. package/dist/query/response/index.d.ts +2 -0
  26. package/dist/query/response/index.js +2 -0
  27. package/dist/query/response/response-mapping.d.ts +23 -0
  28. package/dist/query/response/response-mapping.js +308 -0
  29. package/dist/query/response/response.d.ts +332 -0
  30. package/dist/query/response/response.js +44 -0
  31. package/dist/query/response/server-sent-events.d.ts +14 -0
  32. package/dist/query/response/server-sent-events.js +85 -0
  33. package/dist/query/search.d.ts +37 -0
  34. package/dist/query/search.js +87 -0
  35. package/package.json +46 -3
package/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2020-2023, Weaviate B.V.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,3 +1,131 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <a href="https://github.com/weaviate/agents-typescript-client">
3
+ <img src="./assets/banner.png" alt="Weaviate Agents">
4
+ </a>
5
+ </p>
2
6
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
7
+ <p align="center">
8
+ <a href="https://docs.weaviate.io/query-agent">Docs</a> •
9
+ <a href="https://weaviate.github.io/agents-typescript-client/">Reference Guide</a> •
10
+ <a href="https://weaviate.io">Weaviate</a>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/weaviate/agents-typescript-client/actions"><img src="https://github.com/weaviate/agents-typescript-client/actions/workflows/main.yaml/badge.svg?branch=main" alt="Main Branch"></a>
15
+ <a href="https://www.npmjs.com/package/@weaviate/agents"><img src="https://img.shields.io/npm/v/@weaviate/agents" alt="npm version"></a>
16
+ </p>
17
+
18
+ Weaviate Agents allow you to automatically interface with your Weaviate collections without writing any complex code.
19
+
20
+ # Installation
21
+
22
+ This package is to be used in conjunction with the [Weaviate TypeScript Client](https://github.com/weaviate/typescript-client). Install `@weaviate/node` for Node.js or `@weaviate/web` for browsers; both provide `@weaviate/core`, which is a peer dependency.
23
+
24
+ ```bash
25
+ npm install @weaviate/node @weaviate/agents
26
+ ```
27
+
28
+ Or with yarn / pnpm:
29
+
30
+ ```bash
31
+ yarn add @weaviate/node @weaviate/agents
32
+ ```
33
+
34
+ ```bash
35
+ pnpm add @weaviate/node @weaviate/agents
36
+ ```
37
+
38
+ Requires Node 20+ and a [Weaviate Cloud](https://console.weaviate.cloud) cluster.
39
+
40
+ # Query Agent
41
+
42
+ The Query Agent turns natural-language questions into precise database operations, making full use of:
43
+
44
+ - dynamic filters
45
+ - cross-collection routing
46
+ - query optimization
47
+ - aggregations
48
+
49
+ It returns accurate and relevant results with source citations. It replaces manual query construction and ad-hoc logic with runtime, context-aware planning that optimizes and executes queries across user collections.
50
+
51
+ ## Ask Mode
52
+
53
+ **Ask mode** is natural-language in and natural-language out. It searches or aggregates your data, depending on the user's query, and then answers the question with respect to the retrieved data. This can be accessed using the `ask()` or `askStream()` methods, depending on whether your application needs streaming tokens and progress messages.
54
+
55
+ ```ts
56
+ import weaviate from "@weaviate/node";
57
+ import { QueryAgent } from "@weaviate/agents";
58
+
59
+ const client = await weaviate.connectToWeaviateCloud(clusterUrl, {
60
+ authCredentials,
61
+ });
62
+
63
+ const qa = new QueryAgent(client, {
64
+ collections: ["FinancialContracts"],
65
+ });
66
+
67
+ const res = await qa.ask("Find all contracts signed in 2025");
68
+ ```
69
+
70
+ Ask mode can be optionally customized with:
71
+
72
+ - Output formats for structured outputs
73
+ - LLM-based evaluation of retrieved sources
74
+
75
+ [Learn more about ask mode in the official documentation.](https://docs.weaviate.io/query-agent/guides/ask_mode)
76
+
77
+ ## Search Mode
78
+
79
+ **Search mode** is designed for high quality information retrieval with strong recall and controlled precision, without the final-answer generation. This can be accessed using the `search()` method.
80
+
81
+ ```ts
82
+ import { QueryAgent } from "@weaviate/agents";
83
+
84
+ const qa = new QueryAgent(client, {
85
+ collections: ["ECommerce"],
86
+ });
87
+
88
+ const searchResponse = await qa.search("Find me some vintage shoes under $70", {
89
+ limit: 10,
90
+ effort: "medium",
91
+ });
92
+ ```
93
+
94
+ Search mode can be optionally customized with:
95
+
96
+ - Different filtering strategies for recall or precision based search priorities
97
+ - Effort level to control search quality versus latency
98
+ - Diversity weights to improve diversity amongst results
99
+ - Pagination of the results set
100
+
101
+ [Learn more about search mode in the official documentation.](https://docs.weaviate.io/query-agent/guides/search_mode)
102
+
103
+ # Documentation
104
+
105
+ - [Full documentation](https://docs.weaviate.io/query-agent) for quickstarts, walkthroughs and overviews of how to use the Query Agent
106
+
107
+ - [Tutorials & Guides](https://docs.weaviate.io/query-agent/recipes) for getting started quickly with the Query Agent
108
+
109
+ - [API reference manual](https://weaviate.github.io/agents-typescript-client/index.html) for specific documentation on this client as well as examples
110
+
111
+ # Support
112
+
113
+ - [GitHub issues](https://github.com/weaviate/agents-typescript-client/issues) for bug reports and feature requests
114
+ - [Community forum](https://forum.weaviate.io) for questions and discussion
115
+
116
+ # Citation
117
+
118
+ If you use the Query Agent in your research, please consider citing our paper:
119
+
120
+ ```tex
121
+ @article{query-agent,
122
+ title={Querying databases with function calling},
123
+ author={Shorten, Connor and Pierse, Charles and Smith, Thomas Benjamin and D'Oosterlinck, Karel and Celik, Tuana and Cardenas, Erika and Monigatti, Leonie and Hasan, Mohd Shukri and Schmuhl, Edward and Williams, Daniel and others},
124
+ journal={arXiv preprint arXiv:2502.00032},
125
+ year={2025}
126
+ }
127
+ ```
128
+
129
+ # License
130
+
131
+ [BSD 3-Clause](./LICENSE)
@@ -0,0 +1 @@
1
+ export * from "./query/index.js";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./query/index.js";