-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.ts
76 lines (56 loc) · 1.58 KB
/
docs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import * as Core from '../core';
import { OffsetPagination } from '../pagination';
export class Docs extends APIResource {
/**
* Embed
*/
embed(body: DocEmbedParams, options?: Core.RequestOptions): Core.APIPromise<EmbedQueryResponse> {
return this._client.post('/embed', { body, ...options });
}
/**
* Get Doc
*/
get(docId: string, options?: Core.RequestOptions): Core.APIPromise<Doc> {
return this._client.get(`/docs/${docId}`, options);
}
}
export class DocsOffsetPagination extends OffsetPagination<Doc> {}
export interface Doc {
id: string;
content: string | Array<string>;
created_at: string;
title: string;
embeddings?: Array<number> | Array<Array<number>> | null;
metadata?: unknown | null;
}
export interface EmbedQueryResponse {
vectors: Array<Array<number>>;
}
export interface Snippet {
content: string;
index: number;
embedding?: Array<number> | null;
}
export type DocEmbedParams =
| DocEmbedParams.SingleEmbedQueryRequest
| DocEmbedParams.MultipleEmbedQueryRequest;
export namespace DocEmbedParams {
export interface SingleEmbedQueryRequest {
text: string;
embed_instruction?: string;
}
export interface MultipleEmbedQueryRequest {
text: Array<string>;
embed_instruction?: string;
}
}
export declare namespace Docs {
export {
type Doc as Doc,
type EmbedQueryResponse as EmbedQueryResponse,
type Snippet as Snippet,
type DocEmbedParams as DocEmbedParams,
};
}