exa-js 1.7.3 → 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.
- package/README.md +7 -8
- package/dist/index.d.mts +521 -136
- package/dist/index.d.ts +521 -136
- package/dist/index.js +192 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +188 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -190,7 +190,7 @@ Each chunk contains:
|
|
|
190
190
|
- `content`: A string containing the next piece of generated text
|
|
191
191
|
- `citations`: An array of citation objects containing source information
|
|
192
192
|
|
|
193
|
-
### `exa.research.createTask(
|
|
193
|
+
### `exa.research.createTask({ instructions, schema }: { instructions: string, output?: { schema?: object }}): Promise<{id: string}>`
|
|
194
194
|
|
|
195
195
|
Exa's research agent can autonomously gather information and return a structured JSON object that conforms to a schema you provide.
|
|
196
196
|
|
|
@@ -205,18 +205,17 @@ const schema = {
|
|
|
205
205
|
properties: {
|
|
206
206
|
answer: { type: "string" },
|
|
207
207
|
},
|
|
208
|
+
additionalProperties: false,
|
|
208
209
|
};
|
|
209
210
|
|
|
210
|
-
const { id: taskId } = await exa.research.createTask(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{ schema }
|
|
215
|
-
);
|
|
211
|
+
const { id: taskId } = await exa.research.createTask({
|
|
212
|
+
instructions: "In ≤3 sentences, explain quantum computing.",
|
|
213
|
+
output: { schema },
|
|
214
|
+
});
|
|
216
215
|
const result = await exa.research.pollTask(taskId);
|
|
217
216
|
```
|
|
218
217
|
|
|
219
|
-
Use the `status` field to poll long-running tasks if needed
|
|
218
|
+
Use the `status` field to poll long-running tasks if needed.
|
|
220
219
|
|
|
221
220
|
# Contributing
|
|
222
221
|
|