Skip to content

Commit 1fef177

Browse files
feat(api): add citations (#668)
1 parent a1c7fcd commit 1fef177

File tree

16 files changed

+538
-17
lines changed

16 files changed

+538
-17
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-75f0573c3d6d79650bcbd8b1b4fcf93ce146d567afeb1061cd4afccf8d1d6799.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-7270ee0a79d885681ee507414608229f61c27f47c40f355dcd210b38aa7cddf1.yml

api.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,19 @@ Types:
2222

2323
- <code><a href="./src/resources/messages/messages.ts">Base64PDFSource</a></code>
2424
- <code><a href="./src/resources/messages/messages.ts">CacheControlEphemeral</a></code>
25+
- <code><a href="./src/resources/messages/messages.ts">CitationCharLocation</a></code>
26+
- <code><a href="./src/resources/messages/messages.ts">CitationCharLocationParam</a></code>
27+
- <code><a href="./src/resources/messages/messages.ts">CitationContentBlockLocation</a></code>
28+
- <code><a href="./src/resources/messages/messages.ts">CitationContentBlockLocationParam</a></code>
29+
- <code><a href="./src/resources/messages/messages.ts">CitationPageLocation</a></code>
30+
- <code><a href="./src/resources/messages/messages.ts">CitationPageLocationParam</a></code>
31+
- <code><a href="./src/resources/messages/messages.ts">CitationsConfigParam</a></code>
32+
- <code><a href="./src/resources/messages/messages.ts">CitationsDelta</a></code>
2533
- <code><a href="./src/resources/messages/messages.ts">ContentBlock</a></code>
2634
- <code><a href="./src/resources/messages/messages.ts">ContentBlockDeltaEvent</a></code>
2735
- <code><a href="./src/resources/messages/messages.ts">ContentBlockParam</a></code>
36+
- <code><a href="./src/resources/messages/messages.ts">ContentBlockSource</a></code>
37+
- <code><a href="./src/resources/messages/messages.ts">ContentBlockSourceContent</a></code>
2838
- <code><a href="./src/resources/messages/messages.ts">ContentBlockStartEvent</a></code>
2939
- <code><a href="./src/resources/messages/messages.ts">ContentBlockStopEvent</a></code>
3040
- <code><a href="./src/resources/messages/messages.ts">DocumentBlockParam</a></code>
@@ -40,6 +50,7 @@ Types:
4050
- <code><a href="./src/resources/messages/messages.ts">MessageTokensCount</a></code>
4151
- <code><a href="./src/resources/messages/messages.ts">Metadata</a></code>
4252
- <code><a href="./src/resources/messages/messages.ts">Model</a></code>
53+
- <code><a href="./src/resources/messages/messages.ts">PlainTextSource</a></code>
4354
- <code><a href="./src/resources/messages/messages.ts">RawContentBlockDeltaEvent</a></code>
4455
- <code><a href="./src/resources/messages/messages.ts">RawContentBlockStartEvent</a></code>
4556
- <code><a href="./src/resources/messages/messages.ts">RawContentBlockStopEvent</a></code>
@@ -49,6 +60,8 @@ Types:
4960
- <code><a href="./src/resources/messages/messages.ts">RawMessageStreamEvent</a></code>
5061
- <code><a href="./src/resources/messages/messages.ts">TextBlock</a></code>
5162
- <code><a href="./src/resources/messages/messages.ts">TextBlockParam</a></code>
63+
- <code><a href="./src/resources/messages/messages.ts">TextCitation</a></code>
64+
- <code><a href="./src/resources/messages/messages.ts">TextCitationParam</a></code>
5265
- <code><a href="./src/resources/messages/messages.ts">TextDelta</a></code>
5366
- <code><a href="./src/resources/messages/messages.ts">Tool</a></code>
5467
- <code><a href="./src/resources/messages/messages.ts">ToolChoice</a></code>
@@ -135,15 +148,26 @@ Types:
135148
- <code><a href="./src/resources/beta/messages/messages.ts">BetaBase64PDFBlock</a></code>
136149
- <code><a href="./src/resources/beta/messages/messages.ts">BetaBase64PDFSource</a></code>
137150
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCacheControlEphemeral</a></code>
151+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationCharLocation</a></code>
152+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationCharLocationParam</a></code>
153+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationContentBlockLocation</a></code>
154+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationContentBlockLocationParam</a></code>
155+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationPageLocation</a></code>
156+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationPageLocationParam</a></code>
157+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationsConfigParam</a></code>
158+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaCitationsDelta</a></code>
138159
- <code><a href="./src/resources/beta/messages/messages.ts">BetaContentBlock</a></code>
139160
- <code><a href="./src/resources/beta/messages/messages.ts">BetaContentBlockParam</a></code>
161+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaContentBlockSource</a></code>
162+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaContentBlockSourceContent</a></code>
140163
- <code><a href="./src/resources/beta/messages/messages.ts">BetaImageBlockParam</a></code>
141164
- <code><a href="./src/resources/beta/messages/messages.ts">BetaInputJSONDelta</a></code>
142165
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMessage</a></code>
143166
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMessageDeltaUsage</a></code>
144167
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMessageParam</a></code>
145168
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMessageTokensCount</a></code>
146169
- <code><a href="./src/resources/beta/messages/messages.ts">BetaMetadata</a></code>
170+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaPlainTextSource</a></code>
147171
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRawContentBlockDeltaEvent</a></code>
148172
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRawContentBlockStartEvent</a></code>
149173
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRawContentBlockStopEvent</a></code>
@@ -153,6 +177,8 @@ Types:
153177
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRawMessageStreamEvent</a></code>
154178
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextBlock</a></code>
155179
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextBlockParam</a></code>
180+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextCitation</a></code>
181+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextCitationParam</a></code>
156182
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextDelta</a></code>
157183
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTool</a></code>
158184
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolBash20241022</a></code>

src/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,19 @@ import {
3333
import {
3434
Base64PDFSource,
3535
CacheControlEphemeral,
36+
CitationCharLocation,
37+
CitationCharLocationParam,
38+
CitationContentBlockLocation,
39+
CitationContentBlockLocationParam,
40+
CitationPageLocation,
41+
CitationPageLocationParam,
42+
CitationsConfigParam,
43+
CitationsDelta,
3644
ContentBlock,
3745
ContentBlockDeltaEvent,
3846
ContentBlockParam,
47+
ContentBlockSource,
48+
ContentBlockSourceContent,
3949
ContentBlockStartEvent,
4050
ContentBlockStopEvent,
4151
DocumentBlockParam,
@@ -57,6 +67,7 @@ import {
5767
Messages,
5868
Metadata,
5969
Model,
70+
PlainTextSource,
6071
RawContentBlockDeltaEvent,
6172
RawContentBlockStartEvent,
6273
RawContentBlockStopEvent,
@@ -66,6 +77,8 @@ import {
6677
RawMessageStreamEvent,
6778
TextBlock,
6879
TextBlockParam,
80+
TextCitation,
81+
TextCitationParam,
6982
TextDelta,
7083
Tool,
7184
ToolChoice,
@@ -322,9 +335,19 @@ export declare namespace Anthropic {
322335
Messages as Messages,
323336
type Base64PDFSource as Base64PDFSource,
324337
type CacheControlEphemeral as CacheControlEphemeral,
338+
type CitationCharLocation as CitationCharLocation,
339+
type CitationCharLocationParam as CitationCharLocationParam,
340+
type CitationContentBlockLocation as CitationContentBlockLocation,
341+
type CitationContentBlockLocationParam as CitationContentBlockLocationParam,
342+
type CitationPageLocation as CitationPageLocation,
343+
type CitationPageLocationParam as CitationPageLocationParam,
344+
type CitationsConfigParam as CitationsConfigParam,
345+
type CitationsDelta as CitationsDelta,
325346
type ContentBlock as ContentBlock,
326347
type ContentBlockDeltaEvent as ContentBlockDeltaEvent,
327348
type ContentBlockParam as ContentBlockParam,
349+
type ContentBlockSource as ContentBlockSource,
350+
type ContentBlockSourceContent as ContentBlockSourceContent,
328351
type ContentBlockStartEvent as ContentBlockStartEvent,
329352
type ContentBlockStopEvent as ContentBlockStopEvent,
330353
type DocumentBlockParam as DocumentBlockParam,
@@ -340,6 +363,7 @@ export declare namespace Anthropic {
340363
type MessageTokensCount as MessageTokensCount,
341364
type Metadata as Metadata,
342365
type Model as Model,
366+
type PlainTextSource as PlainTextSource,
343367
type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent,
344368
type RawContentBlockStartEvent as RawContentBlockStartEvent,
345369
type RawContentBlockStopEvent as RawContentBlockStopEvent,
@@ -349,6 +373,8 @@ export declare namespace Anthropic {
349373
type RawMessageStreamEvent as RawMessageStreamEvent,
350374
type TextBlock as TextBlock,
351375
type TextBlockParam as TextBlockParam,
376+
type TextCitation as TextCitation,
377+
type TextCitationParam as TextCitationParam,
352378
type TextDelta as TextDelta,
353379
type Tool as Tool,
354380
type ToolChoice as ToolChoice,

src/resources/beta/beta.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,26 @@ import {
88
BetaBase64PDFBlock,
99
BetaBase64PDFSource,
1010
BetaCacheControlEphemeral,
11+
BetaCitationCharLocation,
12+
BetaCitationCharLocationParam,
13+
BetaCitationContentBlockLocation,
14+
BetaCitationContentBlockLocationParam,
15+
BetaCitationPageLocation,
16+
BetaCitationPageLocationParam,
17+
BetaCitationsConfigParam,
18+
BetaCitationsDelta,
1119
BetaContentBlock,
1220
BetaContentBlockParam,
21+
BetaContentBlockSource,
22+
BetaContentBlockSourceContent,
1323
BetaImageBlockParam,
1424
BetaInputJSONDelta,
1525
BetaMessage,
1626
BetaMessageDeltaUsage,
1727
BetaMessageParam,
1828
BetaMessageTokensCount,
1929
BetaMetadata,
30+
BetaPlainTextSource,
2031
BetaRawContentBlockDeltaEvent,
2132
BetaRawContentBlockStartEvent,
2233
BetaRawContentBlockStopEvent,
@@ -26,6 +37,8 @@ import {
2637
BetaRawMessageStreamEvent,
2738
BetaTextBlock,
2839
BetaTextBlockParam,
40+
BetaTextCitation,
41+
BetaTextCitationParam,
2942
BetaTextDelta,
3043
BetaTool,
3144
BetaToolBash20241022,
@@ -163,15 +176,26 @@ export declare namespace Beta {
163176
type BetaBase64PDFBlock as BetaBase64PDFBlock,
164177
type BetaBase64PDFSource as BetaBase64PDFSource,
165178
type BetaCacheControlEphemeral as BetaCacheControlEphemeral,
179+
type BetaCitationCharLocation as BetaCitationCharLocation,
180+
type BetaCitationCharLocationParam as BetaCitationCharLocationParam,
181+
type BetaCitationContentBlockLocation as BetaCitationContentBlockLocation,
182+
type BetaCitationContentBlockLocationParam as BetaCitationContentBlockLocationParam,
183+
type BetaCitationPageLocation as BetaCitationPageLocation,
184+
type BetaCitationPageLocationParam as BetaCitationPageLocationParam,
185+
type BetaCitationsConfigParam as BetaCitationsConfigParam,
186+
type BetaCitationsDelta as BetaCitationsDelta,
166187
type BetaContentBlock as BetaContentBlock,
167188
type BetaContentBlockParam as BetaContentBlockParam,
189+
type BetaContentBlockSource as BetaContentBlockSource,
190+
type BetaContentBlockSourceContent as BetaContentBlockSourceContent,
168191
type BetaImageBlockParam as BetaImageBlockParam,
169192
type BetaInputJSONDelta as BetaInputJSONDelta,
170193
type BetaMessage as BetaMessage,
171194
type BetaMessageDeltaUsage as BetaMessageDeltaUsage,
172195
type BetaMessageParam as BetaMessageParam,
173196
type BetaMessageTokensCount as BetaMessageTokensCount,
174197
type BetaMetadata as BetaMetadata,
198+
type BetaPlainTextSource as BetaPlainTextSource,
175199
type BetaRawContentBlockDeltaEvent as BetaRawContentBlockDeltaEvent,
176200
type BetaRawContentBlockStartEvent as BetaRawContentBlockStartEvent,
177201
type BetaRawContentBlockStopEvent as BetaRawContentBlockStopEvent,
@@ -181,6 +205,8 @@ export declare namespace Beta {
181205
type BetaRawMessageStreamEvent as BetaRawMessageStreamEvent,
182206
type BetaTextBlock as BetaTextBlock,
183207
type BetaTextBlockParam as BetaTextBlockParam,
208+
type BetaTextCitation as BetaTextCitation,
209+
type BetaTextCitationParam as BetaTextCitationParam,
184210
type BetaTextDelta as BetaTextDelta,
185211
type BetaTool as BetaTool,
186212
type BetaToolBash20241022 as BetaToolBash20241022,

src/resources/beta/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,26 @@ export {
2121
type BetaBase64PDFBlock,
2222
type BetaBase64PDFSource,
2323
type BetaCacheControlEphemeral,
24+
type BetaCitationCharLocation,
25+
type BetaCitationCharLocationParam,
26+
type BetaCitationContentBlockLocation,
27+
type BetaCitationContentBlockLocationParam,
28+
type BetaCitationPageLocation,
29+
type BetaCitationPageLocationParam,
30+
type BetaCitationsConfigParam,
31+
type BetaCitationsDelta,
2432
type BetaContentBlock,
2533
type BetaContentBlockParam,
34+
type BetaContentBlockSource,
35+
type BetaContentBlockSourceContent,
2636
type BetaImageBlockParam,
2737
type BetaInputJSONDelta,
2838
type BetaMessage,
2939
type BetaMessageDeltaUsage,
3040
type BetaMessageParam,
3141
type BetaMessageTokensCount,
3242
type BetaMetadata,
43+
type BetaPlainTextSource,
3344
type BetaRawContentBlockDeltaEvent,
3445
type BetaRawContentBlockStartEvent,
3546
type BetaRawContentBlockStopEvent,
@@ -39,6 +50,8 @@ export {
3950
type BetaRawMessageStreamEvent,
4051
type BetaTextBlock,
4152
type BetaTextBlockParam,
53+
type BetaTextCitation,
54+
type BetaTextCitationParam,
4255
type BetaTextDelta,
4356
type BetaTool,
4457
type BetaToolBash20241022,

src/resources/beta/messages/batches.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ export class Batches extends APIResource {
8686
}
8787

8888
/**
89-
* This endpoint is idempotent and can be used to poll for Message Batch
90-
* completion. To access the results of a Message Batch, make a request to the
91-
* `results_url` field in the response.
89+
* Delete a Message Batch.
90+
*
91+
* Message Batches can only be deleted once they've finished processing. If you'd
92+
* like to delete an in-progress batch, you must first cancel it.
9293
*/
9394
delete(
9495
messageBatchId: string,

src/resources/beta/messages/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,26 @@ export {
2424
type BetaBase64PDFBlock,
2525
type BetaBase64PDFSource,
2626
type BetaCacheControlEphemeral,
27+
type BetaCitationCharLocation,
28+
type BetaCitationCharLocationParam,
29+
type BetaCitationContentBlockLocation,
30+
type BetaCitationContentBlockLocationParam,
31+
type BetaCitationPageLocation,
32+
type BetaCitationPageLocationParam,
33+
type BetaCitationsConfigParam,
34+
type BetaCitationsDelta,
2735
type BetaContentBlock,
2836
type BetaContentBlockParam,
37+
type BetaContentBlockSource,
38+
type BetaContentBlockSourceContent,
2939
type BetaImageBlockParam,
3040
type BetaInputJSONDelta,
3141
type BetaMessage,
3242
type BetaMessageDeltaUsage,
3343
type BetaMessageParam,
3444
type BetaMessageTokensCount,
3545
type BetaMetadata,
46+
type BetaPlainTextSource,
3647
type BetaRawContentBlockDeltaEvent,
3748
type BetaRawContentBlockStartEvent,
3849
type BetaRawContentBlockStopEvent,
@@ -42,6 +53,8 @@ export {
4253
type BetaRawMessageStreamEvent,
4354
type BetaTextBlock,
4455
type BetaTextBlockParam,
56+
type BetaTextCitation,
57+
type BetaTextCitationParam,
4558
type BetaTextDelta,
4659
type BetaTool,
4760
type BetaToolBash20241022,

0 commit comments

Comments
 (0)