Skip to content

Commit f372c0d

Browse files
feat(api): search result content blocks
Promoting citable search results from beta to main
1 parent 5c1689e commit f372c0d

File tree

6 files changed

+78
-7
lines changed

6 files changed

+78
-7
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 26
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-43f38b1226d74e1e6093196a1a9585c240e656a463f5791ffe32c8910726f55b.yml
3-
openapi_spec_hash: f09142bb93ac7ed78f4dc1a47af7b5ed
4-
config_hash: 7154b62ac6eb8c65499cf4d876d618d4
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-ac0fdb790058bd2235b08ddae6576152b9fa43593fe260d35d7bee6bceece7d3.yml
3+
openapi_spec_hash: e3c27dba60dbd66bd9bd1191817cf625
4+
config_hash: dd8784d7be29ec37986f77ec4b1f3187

api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ Types:
2929
- <code><a href="./src/resources/messages/messages.ts">CitationContentBlockLocationParam</a></code>
3030
- <code><a href="./src/resources/messages/messages.ts">CitationPageLocation</a></code>
3131
- <code><a href="./src/resources/messages/messages.ts">CitationPageLocationParam</a></code>
32+
- <code><a href="./src/resources/messages/messages.ts">CitationSearchResultLocationParam</a></code>
3233
- <code><a href="./src/resources/messages/messages.ts">CitationWebSearchResultLocationParam</a></code>
3334
- <code><a href="./src/resources/messages/messages.ts">CitationsConfigParam</a></code>
3435
- <code><a href="./src/resources/messages/messages.ts">CitationsDelta</a></code>
36+
- <code><a href="./src/resources/messages/messages.ts">CitationsSearchResultLocation</a></code>
3537
- <code><a href="./src/resources/messages/messages.ts">CitationsWebSearchResultLocation</a></code>
3638
- <code><a href="./src/resources/messages/messages.ts">ContentBlock</a></code>
3739
- <code><a href="./src/resources/messages/messages.ts">ContentBlockParam</a></code>
@@ -61,6 +63,7 @@ Types:
6163
- <code><a href="./src/resources/messages/messages.ts">RawMessageStreamEvent</a></code>
6264
- <code><a href="./src/resources/messages/messages.ts">RedactedThinkingBlock</a></code>
6365
- <code><a href="./src/resources/messages/messages.ts">RedactedThinkingBlockParam</a></code>
66+
- <code><a href="./src/resources/messages/messages.ts">SearchResultBlockParam</a></code>
6467
- <code><a href="./src/resources/messages/messages.ts">ServerToolUsage</a></code>
6568
- <code><a href="./src/resources/messages/messages.ts">ServerToolUseBlock</a></code>
6669
- <code><a href="./src/resources/messages/messages.ts">ServerToolUseBlockParam</a></code>

src/client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ import {
5151
CitationContentBlockLocationParam,
5252
CitationPageLocation,
5353
CitationPageLocationParam,
54+
CitationSearchResultLocationParam,
5455
CitationWebSearchResultLocationParam,
5556
CitationsConfigParam,
5657
CitationsDelta,
58+
CitationsSearchResultLocation,
5759
CitationsWebSearchResultLocation,
5860
ContentBlock,
5961
ContentBlockDeltaEvent,
@@ -93,6 +95,7 @@ import {
9395
RawMessageStreamEvent,
9496
RedactedThinkingBlock,
9597
RedactedThinkingBlockParam,
98+
SearchResultBlockParam,
9699
ServerToolUsage,
97100
ServerToolUseBlock,
98101
ServerToolUseBlockParam,
@@ -976,9 +979,11 @@ export declare namespace Anthropic {
976979
type CitationContentBlockLocationParam as CitationContentBlockLocationParam,
977980
type CitationPageLocation as CitationPageLocation,
978981
type CitationPageLocationParam as CitationPageLocationParam,
982+
type CitationSearchResultLocationParam as CitationSearchResultLocationParam,
979983
type CitationWebSearchResultLocationParam as CitationWebSearchResultLocationParam,
980984
type CitationsConfigParam as CitationsConfigParam,
981985
type CitationsDelta as CitationsDelta,
986+
type CitationsSearchResultLocation as CitationsSearchResultLocation,
982987
type CitationsWebSearchResultLocation as CitationsWebSearchResultLocation,
983988
type ContentBlock as ContentBlock,
984989
type ContentBlockDeltaEvent as ContentBlockDeltaEvent,
@@ -1012,6 +1017,7 @@ export declare namespace Anthropic {
10121017
type RawMessageStreamEvent as RawMessageStreamEvent,
10131018
type RedactedThinkingBlock as RedactedThinkingBlock,
10141019
type RedactedThinkingBlockParam as RedactedThinkingBlockParam,
1020+
type SearchResultBlockParam as SearchResultBlockParam,
10151021
type ServerToolUsage as ServerToolUsage,
10161022
type ServerToolUseBlock as ServerToolUseBlock,
10171023
type ServerToolUseBlockParam as ServerToolUseBlockParam,

src/resources/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ export {
3434
type CitationContentBlockLocationParam,
3535
type CitationPageLocation,
3636
type CitationPageLocationParam,
37+
type CitationSearchResultLocationParam,
3738
type CitationWebSearchResultLocationParam,
3839
type CitationsConfigParam,
3940
type CitationsDelta,
41+
type CitationsSearchResultLocation,
4042
type CitationsWebSearchResultLocation,
4143
type ContentBlock,
4244
type ContentBlockParam,
@@ -67,6 +69,7 @@ export {
6769
type RawMessageStreamEvent,
6870
type RedactedThinkingBlock,
6971
type RedactedThinkingBlockParam,
72+
type SearchResultBlockParam,
7073
type ServerToolUsage,
7174
type ServerToolUseBlock,
7275
type ServerToolUseBlockParam,

src/resources/messages/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ export {
2626
type CitationContentBlockLocationParam,
2727
type CitationPageLocation,
2828
type CitationPageLocationParam,
29+
type CitationSearchResultLocationParam,
2930
type CitationWebSearchResultLocationParam,
3031
type CitationsConfigParam,
3132
type CitationsDelta,
33+
type CitationsSearchResultLocation,
3234
type CitationsWebSearchResultLocation,
3335
type ContentBlock,
3436
type ContentBlockParam,
@@ -58,6 +60,7 @@ export {
5860
type RawMessageStreamEvent,
5961
type RedactedThinkingBlock,
6062
type RedactedThinkingBlockParam,
63+
type SearchResultBlockParam,
6164
type ServerToolUsage,
6265
type ServerToolUseBlock,
6366
type ServerToolUseBlockParam,

src/resources/messages/messages.ts

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,22 @@ export interface CitationPageLocationParam {
219219
type: 'page_location';
220220
}
221221

222+
export interface CitationSearchResultLocationParam {
223+
cited_text: string;
224+
225+
end_block_index: number;
226+
227+
search_result_index: number;
228+
229+
source: string;
230+
231+
start_block_index: number;
232+
233+
title: string | null;
234+
235+
type: 'search_result_location';
236+
}
237+
222238
export interface CitationWebSearchResultLocationParam {
223239
cited_text: string;
224240

@@ -240,11 +256,28 @@ export interface CitationsDelta {
240256
| CitationCharLocation
241257
| CitationPageLocation
242258
| CitationContentBlockLocation
243-
| CitationsWebSearchResultLocation;
259+
| CitationsWebSearchResultLocation
260+
| CitationsSearchResultLocation;
244261

245262
type: 'citations_delta';
246263
}
247264

265+
export interface CitationsSearchResultLocation {
266+
cited_text: string;
267+
268+
end_block_index: number;
269+
270+
search_result_index: number;
271+
272+
source: string;
273+
274+
start_block_index: number;
275+
276+
title: string | null;
277+
278+
type: 'search_result_location';
279+
}
280+
248281
export interface CitationsWebSearchResultLocation {
249282
cited_text: string;
250283

@@ -272,6 +305,7 @@ export type ContentBlockParam =
272305
| TextBlockParam
273306
| ImageBlockParam
274307
| DocumentBlockParam
308+
| SearchResultBlockParam
275309
| ThinkingBlockParam
276310
| RedactedThinkingBlockParam
277311
| ToolUseBlockParam
@@ -638,6 +672,23 @@ export interface RedactedThinkingBlockParam {
638672
type: 'redacted_thinking';
639673
}
640674

675+
export interface SearchResultBlockParam {
676+
content: Array<TextBlockParam>;
677+
678+
source: string;
679+
680+
title: string;
681+
682+
type: 'search_result';
683+
684+
/**
685+
* Create a cache control breakpoint at this content block.
686+
*/
687+
cache_control?: CacheControlEphemeral | null;
688+
689+
citations?: CitationsConfigParam;
690+
}
691+
641692
export interface ServerToolUsage {
642693
/**
643694
* The number of web search tool requests.
@@ -710,13 +761,15 @@ export type TextCitation =
710761
| CitationCharLocation
711762
| CitationPageLocation
712763
| CitationContentBlockLocation
713-
| CitationsWebSearchResultLocation;
764+
| CitationsWebSearchResultLocation
765+
| CitationsSearchResultLocation;
714766

715767
export type TextCitationParam =
716768
| CitationCharLocationParam
717769
| CitationPageLocationParam
718770
| CitationContentBlockLocationParam
719-
| CitationWebSearchResultLocationParam;
771+
| CitationWebSearchResultLocationParam
772+
| CitationSearchResultLocationParam;
720773

721774
export interface TextDelta {
722775
text: string;
@@ -921,7 +974,7 @@ export interface ToolResultBlockParam {
921974
*/
922975
cache_control?: CacheControlEphemeral | null;
923976

924-
content?: string | Array<TextBlockParam | ImageBlockParam>;
977+
content?: string | Array<TextBlockParam | ImageBlockParam | SearchResultBlockParam>;
925978

926979
is_error?: boolean;
927980
}
@@ -1755,9 +1808,11 @@ export declare namespace Messages {
17551808
type CitationContentBlockLocationParam as CitationContentBlockLocationParam,
17561809
type CitationPageLocation as CitationPageLocation,
17571810
type CitationPageLocationParam as CitationPageLocationParam,
1811+
type CitationSearchResultLocationParam as CitationSearchResultLocationParam,
17581812
type CitationWebSearchResultLocationParam as CitationWebSearchResultLocationParam,
17591813
type CitationsConfigParam as CitationsConfigParam,
17601814
type CitationsDelta as CitationsDelta,
1815+
type CitationsSearchResultLocation as CitationsSearchResultLocation,
17611816
type CitationsWebSearchResultLocation as CitationsWebSearchResultLocation,
17621817
type ContentBlock as ContentBlock,
17631818
type ContentBlockParam as ContentBlockParam,
@@ -1787,6 +1842,7 @@ export declare namespace Messages {
17871842
type RawMessageStreamEvent as RawMessageStreamEvent,
17881843
type RedactedThinkingBlock as RedactedThinkingBlock,
17891844
type RedactedThinkingBlockParam as RedactedThinkingBlockParam,
1845+
type SearchResultBlockParam as SearchResultBlockParam,
17901846
type ServerToolUsage as ServerToolUsage,
17911847
type ServerToolUseBlock as ServerToolUseBlock,
17921848
type ServerToolUseBlockParam as ServerToolUseBlockParam,

0 commit comments

Comments
 (0)