Skip to content

Commit 263c019

Browse files
authored
feat(askfern): Support custom context indexing. (#3278)
1 parent 44ed9ec commit 263c019

File tree

26 files changed

+1476
-27
lines changed

26 files changed

+1476
-27
lines changed

fern/apis/fai/definition/index.yml

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,65 @@ service:
2525
type: string
2626
docs: A unique identifier for the document
2727
context:
28-
type: string
29-
docs: The context of the document that will be indexed
28+
type: list<string>
29+
docs: The context of the document, as a list of strings, that will be indexed.
3030
content:
3131
type: string
3232
docs: The content of the document that will be returned in the tool response
3333
errors:
3434
- commons.BadRequestError
3535
- commons.InternalError
36+
37+
getDocument:
38+
docs: Get a document for a given domain
39+
path: /{domain}
40+
method: GET
41+
path-parameters:
42+
domain: string
43+
request:
44+
name: GetRequest
45+
query-parameters:
46+
document_id:
47+
type: string
48+
docs: The unique identifier of the document to get
49+
errors:
50+
- commons.BadRequestError
51+
- commons.InternalError
52+
53+
updateDocument:
54+
docs: Update a document for a given domain
55+
path: /{domain}/update
56+
method: POST
57+
path-parameters:
58+
domain: string
59+
request:
60+
name: UpdateRequest
61+
query-parameters:
62+
document_id:
63+
type: string
64+
docs: The unique identifier of the document to update
65+
is_active:
66+
type: boolean
67+
docs: Whether the document is active
68+
context:
69+
type: list<string>
70+
docs: The context of the document, as a list of strings, that will be indexed.
71+
content:
72+
type: string
73+
docs: The content of the document that will be returned in the tool response. If not provided, the document will be removed from the index.
74+
response: ContextResponse
75+
errors:
76+
- commons.BadRequestError
77+
- commons.InternalError
78+
79+
types:
80+
ContextResponse:
81+
properties:
82+
document_id: string
83+
domain: string
84+
context_id: string
85+
context: list<string>
86+
content: string
87+
is_active: boolean
88+
created_at: datetime
89+
updated_at: datetime

packages/fai-sdk/reference.md

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ Index a document for a given domain
338338
await client.index.indexDocument("domain", {
339339
index_name: undefined,
340340
document_id: "document_id",
341-
context: "context",
341+
context: ["context", "context"],
342342
content: "content",
343343
});
344344
```
@@ -383,6 +383,155 @@ await client.index.indexDocument("domain", {
383383
</dl>
384384
</details>
385385

386+
<details><summary><code>client.index.<a href="/src/api/resources/index/client/Client.ts">getDocument</a>(domain, { ...params }) -> void</code></summary>
387+
<dl>
388+
<dd>
389+
390+
#### 📝 Description
391+
392+
<dl>
393+
<dd>
394+
395+
<dl>
396+
<dd>
397+
398+
Get a document for a given domain
399+
400+
</dd>
401+
</dl>
402+
</dd>
403+
</dl>
404+
405+
#### 🔌 Usage
406+
407+
<dl>
408+
<dd>
409+
410+
<dl>
411+
<dd>
412+
413+
```typescript
414+
await client.index.getDocument("domain", {
415+
document_id: "document_id",
416+
});
417+
```
418+
419+
</dd>
420+
</dl>
421+
</dd>
422+
</dl>
423+
424+
#### ⚙️ Parameters
425+
426+
<dl>
427+
<dd>
428+
429+
<dl>
430+
<dd>
431+
432+
**domain:** `string`
433+
434+
</dd>
435+
</dl>
436+
437+
<dl>
438+
<dd>
439+
440+
**request:** `FernFai.GetRequest`
441+
442+
</dd>
443+
</dl>
444+
445+
<dl>
446+
<dd>
447+
448+
**requestOptions:** `Index.RequestOptions`
449+
450+
</dd>
451+
</dl>
452+
</dd>
453+
</dl>
454+
455+
</dd>
456+
</dl>
457+
</details>
458+
459+
<details><summary><code>client.index.<a href="/src/api/resources/index/client/Client.ts">updateDocument</a>(domain, { ...params }) -> FernFai.ContextResponse</code></summary>
460+
<dl>
461+
<dd>
462+
463+
#### 📝 Description
464+
465+
<dl>
466+
<dd>
467+
468+
<dl>
469+
<dd>
470+
471+
Update a document for a given domain
472+
473+
</dd>
474+
</dl>
475+
</dd>
476+
</dl>
477+
478+
#### 🔌 Usage
479+
480+
<dl>
481+
<dd>
482+
483+
<dl>
484+
<dd>
485+
486+
```typescript
487+
await client.index.updateDocument("domain", {
488+
document_id: "document_id",
489+
is_active: true,
490+
context: ["context", "context"],
491+
content: "content",
492+
});
493+
```
494+
495+
</dd>
496+
</dl>
497+
</dd>
498+
</dl>
499+
500+
#### ⚙️ Parameters
501+
502+
<dl>
503+
<dd>
504+
505+
<dl>
506+
<dd>
507+
508+
**domain:** `string`
509+
510+
</dd>
511+
</dl>
512+
513+
<dl>
514+
<dd>
515+
516+
**request:** `FernFai.UpdateRequest`
517+
518+
</dd>
519+
</dl>
520+
521+
<dl>
522+
<dd>
523+
524+
**requestOptions:** `Index.RequestOptions`
525+
526+
</dd>
527+
</dl>
528+
</dd>
529+
</dl>
530+
531+
</dd>
532+
</dl>
533+
</details>
534+
386535
## Queries
387536

388537
<details><summary><code>client.queries.<a href="/src/api/resources/queries/client/Client.ts">createQuery</a>({ ...params }) -> void</code></summary>

packages/fai-sdk/src/Client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class FernFaiClient {
4848
{
4949
"X-Fern-Language": "JavaScript",
5050
"X-Fern-SDK-Name": "@fern-api/fai-sdk",
51-
"X-Fern-SDK-Version": "0.0.43",
51+
"X-Fern-SDK-Version": "0.0.51",
5252
"X-Fern-Runtime": core.RUNTIME.type,
5353
"X-Fern-Runtime-Version": core.RUNTIME.version,
5454
},

packages/fai-sdk/src/api/resources/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ export * as chat from "./chat/index.js";
44
export * from "./chat/types/index.js";
55
export * as conversations from "./conversations/index.js";
66
export * from "./conversations/types/index.js";
7+
export * as index from "./index/index.js";
8+
export * from "./index/types/index.js";
79
export * as queries from "./queries/index.js";
810
export * from "./queries/types/index.js";
911
export * as commons from "./commons/index.js";
1012
export * from "./commons/errors/index.js";
11-
export * as index from "./index/index.js";
1213
export * from "./analytics/client/requests/index.js";
1314
export * from "./chat/client/requests/index.js";
1415
export * from "./index/client/requests/index.js";

0 commit comments

Comments
 (0)