Skip to content

Commit 8c0e374

Browse files
feat: add search routes
1 parent 78c076e commit 8c0e374

File tree

11 files changed

+522
-108
lines changed

11 files changed

+522
-108
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 117
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/letta-ai%2Fletta-sdk-467b56c7f84bbc387cccfda48345431547f7e621bfb06f005ea5844de77f1858.yml
3-
openapi_spec_hash: ad37dbb38f5802754d614f1bb51e1b21
4-
config_hash: adc4dc768447fe1323ab69965879aef4
1+
configured_endpoints: 120
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/letta-ai%2Fletta-sdk-4e14f08c6f1c6bc43d4ade3d273ed496dcd340f54f94f5186bfae7855bfc41d2.yml
3+
openapi_spec_hash: 68cc3920d034bba6b9e1ccfc34ec42f7
4+
config_hash: f306cb189924fda3d07cc8a7c437b8f1

api.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,17 +248,13 @@ Methods:
248248
- <code title="get /v1/archives/{archive_id}">client.archives.<a href="./src/resources/archives/archives.ts">retrieve</a>(archiveID) -> Archive</code>
249249
- <code title="patch /v1/archives/{archive_id}">client.archives.<a href="./src/resources/archives/archives.ts">update</a>(archiveID, { ...params }) -> Archive</code>
250250
- <code title="get /v1/archives/">client.archives.<a href="./src/resources/archives/archives.ts">list</a>({ ...params }) -> ArchivesArrayPage</code>
251-
- <code title="delete /v1/archives/{archive_id}">client.archives.<a href="./src/resources/archives/archives.ts">delete</a>(archiveID) -> Archive</code>
251+
- <code title="delete /v1/archives/{archive_id}">client.archives.<a href="./src/resources/archives/archives.ts">delete</a>(archiveID) -> void</code>
252252

253253
## Passages
254254

255-
Types:
256-
257-
- <code><a href="./src/resources/archives/passages.ts">PassageCreateResponse</a></code>
258-
259255
Methods:
260256

261-
- <code title="post /v1/archives/{archive_id}/passages">client.archives.passages.<a href="./src/resources/archives/passages.ts">create</a>(archiveID, { ...params }) -> PassageCreateResponse</code>
257+
- <code title="post /v1/archives/{archive_id}/passages">client.archives.passages.<a href="./src/resources/archives/passages.ts">create</a>(archiveID, { ...params }) -> Passage</code>
262258
- <code title="delete /v1/archives/{archive_id}/passages/{passage_id}">client.archives.passages.<a href="./src/resources/archives/passages.ts">delete</a>(passageID, { ...params }) -> void</code>
263259

264260
# Folders
@@ -549,6 +545,31 @@ Methods:
549545
- <code title="patch /v1/groups/{group_id}/reset-messages">client.groups.messages.<a href="./src/resources/groups/messages.ts">reset</a>(groupID) -> unknown</code>
550546
- <code title="post /v1/groups/{group_id}/messages/stream">client.groups.messages.<a href="./src/resources/groups/messages.ts">stream</a>(groupID, { ...params }) -> unknown</code>
551547

548+
# Messages
549+
550+
Types:
551+
552+
- <code><a href="./src/resources/messages.ts">MessageSearchRequest</a></code>
553+
- <code><a href="./src/resources/messages.ts">MessageSearchResult</a></code>
554+
- <code><a href="./src/resources/messages.ts">MessageListResponse</a></code>
555+
- <code><a href="./src/resources/messages.ts">MessageSearchResponse</a></code>
556+
557+
Methods:
558+
559+
- <code title="get /v1/messages/">client.messages.<a href="./src/resources/messages.ts">list</a>({ ...params }) -> MessageListResponse</code>
560+
- <code title="post /v1/messages/search">client.messages.<a href="./src/resources/messages.ts">search</a>({ ...params }) -> MessageSearchResponse</code>
561+
562+
# Passages
563+
564+
Types:
565+
566+
- <code><a href="./src/resources/passages.ts">Passage</a></code>
567+
- <code><a href="./src/resources/passages.ts">PassageSearchResponse</a></code>
568+
569+
Methods:
570+
571+
- <code title="post /v1/passages/search">client.passages.<a href="./src/resources/passages.ts">search</a>({ ...params }) -> PassageSearchResponse</code>
572+
552573
# Batches
553574

554575
Types:

src/client.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ import {
3838
AccessTokenListResponse,
3939
AccessTokens,
4040
} from './resources/access-tokens';
41+
import {
42+
MessageListParams,
43+
MessageListResponse,
44+
MessageSearchParams,
45+
MessageSearchRequest,
46+
MessageSearchResponse,
47+
MessageSearchResult,
48+
Messages,
49+
} from './resources/messages';
50+
import { Passage, PassageSearchParams, PassageSearchResponse, Passages } from './resources/passages';
4151
import { TagListParams, TagListResponse, Tags } from './resources/tags';
4252
import {
4353
NpmRequirement,
@@ -956,6 +966,8 @@ export class Letta {
956966
tags: API.Tags = new API.Tags(this);
957967
identities: API.Identities = new API.Identities(this);
958968
groups: API.Groups = new API.Groups(this);
969+
messages: API.Messages = new API.Messages(this);
970+
passages: API.Passages = new API.Passages(this);
959971
batches: API.Batches = new API.Batches(this);
960972
accessTokens: API.AccessTokens = new API.AccessTokens(this);
961973
}
@@ -973,6 +985,8 @@ Letta.Templates = Templates;
973985
Letta.Tags = Tags;
974986
Letta.Identities = Identities;
975987
Letta.Groups = Groups;
988+
Letta.Messages = Messages;
989+
Letta.Passages = Passages;
976990
Letta.Batches = Batches;
977991
Letta.AccessTokens = AccessTokens;
978992

@@ -1165,6 +1179,23 @@ export declare namespace Letta {
11651179
type GroupListParams as GroupListParams,
11661180
};
11671181

1182+
export {
1183+
Messages as Messages,
1184+
type MessageSearchRequest as MessageSearchRequest,
1185+
type MessageSearchResult as MessageSearchResult,
1186+
type MessageListResponse as MessageListResponse,
1187+
type MessageSearchResponse as MessageSearchResponse,
1188+
type MessageListParams as MessageListParams,
1189+
type MessageSearchParams as MessageSearchParams,
1190+
};
1191+
1192+
export {
1193+
Passages as Passages,
1194+
type Passage as Passage,
1195+
type PassageSearchResponse as PassageSearchResponse,
1196+
type PassageSearchParams as PassageSearchParams,
1197+
};
1198+
11681199
export {
11691200
Batches as Batches,
11701201
type BatchJob as BatchJob,

src/resources/archives/archives.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import { APIResource } from '../../core/resource';
44
import * as PassagesAPI from './passages';
5-
import { PassageCreateParams, PassageCreateResponse, PassageDeleteParams, Passages } from './passages';
5+
import { PassageCreateParams, PassageDeleteParams, Passages } from './passages';
66
import * as ModelsAPI from '../models/models';
77
import { APIPromise } from '../../core/api-promise';
88
import { ArrayPage, type ArrayPageParams, PagePromise } from '../../core/pagination';
9+
import { buildHeaders } from '../../internal/headers';
910
import { RequestOptions } from '../../internal/request-options';
1011
import { path } from '../../internal/utils/path';
1112

@@ -47,8 +48,11 @@ export class Archives extends APIResource {
4748
/**
4849
* Delete an archive by its ID.
4950
*/
50-
delete(archiveID: string, options?: RequestOptions): APIPromise<Archive> {
51-
return this._client.delete(path`/v1/archives/${archiveID}`, options);
51+
delete(archiveID: string, options?: RequestOptions): APIPromise<void> {
52+
return this._client.delete(path`/v1/archives/${archiveID}`, {
53+
...options,
54+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
55+
});
5256
}
5357
}
5458

@@ -163,7 +167,6 @@ export declare namespace Archives {
163167

164168
export {
165169
Passages as Passages,
166-
type PassageCreateResponse as PassageCreateResponse,
167170
type PassageCreateParams as PassageCreateParams,
168171
type PassageDeleteParams as PassageDeleteParams,
169172
};

src/resources/archives/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,4 @@ export {
99
type ArchiveListParams,
1010
type ArchivesArrayPage,
1111
} from './archives';
12-
export {
13-
Passages,
14-
type PassageCreateResponse,
15-
type PassageCreateParams,
16-
type PassageDeleteParams,
17-
} from './passages';
12+
export { Passages, type PassageCreateParams, type PassageDeleteParams } from './passages';

src/resources/archives/passages.ts

Lines changed: 3 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../../core/resource';
4-
import * as ModelsAPI from '../models/models';
4+
import * as PassagesAPI from '../passages';
55
import { APIPromise } from '../../core/api-promise';
66
import { buildHeaders } from '../../internal/headers';
77
import { RequestOptions } from '../../internal/request-options';
@@ -17,7 +17,7 @@ export class Passages extends APIResource {
1717
archiveID: string,
1818
body: PassageCreateParams,
1919
options?: RequestOptions,
20-
): APIPromise<PassageCreateResponse> {
20+
): APIPromise<PassagesAPI.Passage> {
2121
return this._client.post(path`/v1/archives/${archiveID}/passages`, { body, ...options });
2222
}
2323

@@ -36,87 +36,6 @@ export class Passages extends APIResource {
3636
}
3737
}
3838

39-
/**
40-
* Representation of a passage, which is stored in archival memory.
41-
*/
42-
export interface PassageCreateResponse {
43-
/**
44-
* The embedding of the passage.
45-
*/
46-
embedding: Array<number> | null;
47-
48-
/**
49-
* Configuration for embedding model connection and processing parameters.
50-
*/
51-
embedding_config: ModelsAPI.EmbeddingConfig | null;
52-
53-
/**
54-
* The text of the passage.
55-
*/
56-
text: string;
57-
58-
/**
59-
* The human-friendly ID of the Passage
60-
*/
61-
id?: string;
62-
63-
/**
64-
* The unique identifier of the archive containing this passage.
65-
*/
66-
archive_id?: string | null;
67-
68-
/**
69-
* The creation date of the passage.
70-
*/
71-
created_at?: string;
72-
73-
/**
74-
* The id of the user that made this object.
75-
*/
76-
created_by_id?: string | null;
77-
78-
/**
79-
* The unique identifier of the file associated with the passage.
80-
*/
81-
file_id?: string | null;
82-
83-
/**
84-
* The name of the file (only for source passages).
85-
*/
86-
file_name?: string | null;
87-
88-
/**
89-
* Whether this passage is deleted or not.
90-
*/
91-
is_deleted?: boolean;
92-
93-
/**
94-
* The id of the user that made this object.
95-
*/
96-
last_updated_by_id?: string | null;
97-
98-
/**
99-
* The metadata of the passage.
100-
*/
101-
metadata?: { [key: string]: unknown } | null;
102-
103-
/**
104-
* @deprecated Deprecated: Use `folder_id` field instead. The data source of the
105-
* passage.
106-
*/
107-
source_id?: string | null;
108-
109-
/**
110-
* Tags associated with this passage.
111-
*/
112-
tags?: Array<string> | null;
113-
114-
/**
115-
* The timestamp when the object was last updated.
116-
*/
117-
updated_at?: string | null;
118-
}
119-
12039
export interface PassageCreateParams {
12140
/**
12241
* The text content of the passage
@@ -142,9 +61,5 @@ export interface PassageDeleteParams {
14261
}
14362

14463
export declare namespace Passages {
145-
export {
146-
type PassageCreateResponse as PassageCreateResponse,
147-
type PassageCreateParams as PassageCreateParams,
148-
type PassageDeleteParams as PassageDeleteParams,
149-
};
64+
export { type PassageCreateParams as PassageCreateParams, type PassageDeleteParams as PassageDeleteParams };
15065
}

src/resources/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ export {
134134
type McpServerUpdateParams,
135135
type McpServerRefreshParams,
136136
} from './mcp-servers/mcp-servers';
137+
export {
138+
Messages,
139+
type MessageSearchRequest,
140+
type MessageSearchResult,
141+
type MessageListResponse,
142+
type MessageSearchResponse,
143+
type MessageListParams,
144+
type MessageSearchParams,
145+
} from './messages';
137146
export {
138147
Models,
139148
type EmbeddingConfig,
@@ -145,6 +154,7 @@ export {
145154
type ModelListResponse,
146155
type ModelListParams,
147156
} from './models/models';
157+
export { Passages, type Passage, type PassageSearchResponse, type PassageSearchParams } from './passages';
148158
export { Runs, type Job, type StopReasonType, type RunListParams } from './runs/runs';
149159
export {
150160
Steps,

0 commit comments

Comments
 (0)