Skip to content

Commit 335e9b2

Browse files
feat(api): OpenAPI spec update via Stainless API (#234)
1 parent 0d4fb79 commit 335e9b2

File tree

6 files changed

+64
-56
lines changed

6 files changed

+64
-56
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: 22
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-9cff8ea13f14bd0899df69243fe78b4f88d4d0172263aa260af1ea66a7d0484e.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-6c87a6d2f0a1447fab78657f8b44e2d1ea2c282d2c9f92458bcd25f543944c6e.yml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const { data: completionCreateResponse, response: raw } = await client.completio
158158
.create('1212121')
159159
.withResponse();
160160
console.log(raw.headers.get('X-My-Header'));
161-
console.log(completionCreateResponse.message);
161+
console.log(completionCreateResponse.provider);
162162
```
163163

164164
### Making custom/undocumented requests

src/resources/completion.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ export interface CompletionCreateResponse {
3636
*/
3737
message: CompletionCreateResponse.Message;
3838

39+
name: string;
40+
41+
/**
42+
* The LLM model provider.
43+
*/
44+
provider: 'ANTHROPIC' | 'OPENAI';
45+
3946
stats: CompletionCreateResponse.Stats;
4047
}
4148

@@ -45,7 +52,7 @@ export namespace CompletionCreateResponse {
4552
*/
4653
export interface Message {
4754
content: Array<
48-
| Message.TextContentBlockSchema
55+
| Message.TextContentBlock
4956
| Message.ImageBase64ContentBlock
5057
| Message.ToolCallContentBlock
5158
| Message.ToolResultContentBlock
@@ -55,7 +62,7 @@ export namespace CompletionCreateResponse {
5562
}
5663

5764
export namespace Message {
58-
export interface TextContentBlockSchema {
65+
export interface TextContentBlock {
5966
text: string;
6067

6168
type: 'TEXT';
@@ -167,7 +174,7 @@ export interface CompletionCreateParams {
167174
export namespace CompletionCreateParams {
168175
export interface AppendMessage {
169176
content: Array<
170-
| AppendMessage.TextContentBlockSchema
177+
| AppendMessage.TextContentBlock
171178
| AppendMessage.ImageBase64ContentBlock
172179
| AppendMessage.ToolCallContentBlock
173180
| AppendMessage.ToolResultContentBlock
@@ -177,7 +184,7 @@ export namespace CompletionCreateParams {
177184
}
178185

179186
export namespace AppendMessage {
180-
export interface TextContentBlockSchema {
187+
export interface TextContentBlock {
181188
text: string;
182189

183190
type: 'TEXT';
@@ -241,7 +248,7 @@ export namespace CompletionCreateParams {
241248

242249
export interface OverrideMessage {
243250
content: Array<
244-
| OverrideMessage.TextContentBlockSchema
251+
| OverrideMessage.TextContentBlock
245252
| OverrideMessage.ImageBase64ContentBlock
246253
| OverrideMessage.ToolCallContentBlock
247254
| OverrideMessage.ToolResultContentBlock
@@ -251,7 +258,7 @@ export namespace CompletionCreateParams {
251258
}
252259

253260
export namespace OverrideMessage {
254-
export interface TextContentBlockSchema {
261+
export interface TextContentBlock {
255262
text: string;
256263

257264
type: 'TEXT';

src/resources/evaluations.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export interface Evaluation {
7474
export namespace Evaluation {
7575
export interface AppendedMessage {
7676
content: Array<
77-
| AppendedMessage.TextContentBlockSchema
77+
| AppendedMessage.TextContentBlock
7878
| AppendedMessage.ImageBase64ContentBlock
7979
| AppendedMessage.ToolCallContentBlock
8080
| AppendedMessage.ToolResultContentBlock
@@ -84,7 +84,7 @@ export namespace Evaluation {
8484
}
8585

8686
export namespace AppendedMessage {
87-
export interface TextContentBlockSchema {
87+
export interface TextContentBlock {
8888
text: string;
8989

9090
type: 'TEXT';
@@ -180,7 +180,7 @@ export interface EvaluationCreateParams {
180180
export namespace EvaluationCreateParams {
181181
export interface AppendedMessage {
182182
content: Array<
183-
| AppendedMessage.TextContentBlockSchema
183+
| AppendedMessage.TextContentBlock
184184
| AppendedMessage.ImageBase64ContentBlock
185185
| AppendedMessage.ToolCallContentBlock
186186
| AppendedMessage.ToolResultContentBlock
@@ -190,7 +190,7 @@ export namespace EvaluationCreateParams {
190190
}
191191

192192
export namespace AppendedMessage {
193-
export interface TextContentBlockSchema {
193+
export interface TextContentBlock {
194194
text: string;
195195

196196
type: 'TEXT';
@@ -280,7 +280,7 @@ export interface EvaluationUpdateParams {
280280
export namespace EvaluationUpdateParams {
281281
export interface AppendedMessage {
282282
content: Array<
283-
| AppendedMessage.TextContentBlockSchema
283+
| AppendedMessage.TextContentBlock
284284
| AppendedMessage.ImageBase64ContentBlock
285285
| AppendedMessage.ToolCallContentBlock
286286
| AppendedMessage.ToolResultContentBlock
@@ -290,7 +290,7 @@ export namespace EvaluationUpdateParams {
290290
}
291291

292292
export namespace AppendedMessage {
293-
export interface TextContentBlockSchema {
293+
export interface TextContentBlock {
294294
text: string;
295295

296296
type: 'TEXT';

src/resources/prompts.ts

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ export class Prompts extends APIResource {
4747
}
4848

4949
/**
50-
* Fetches the model configuration parameters for a specified prompt, including
51-
* penalty settings, response format, and the model messages rendered with the
52-
* given variables mapped to the set LLM provider.
50+
* Fetches the configured model parameters and messages rendered with the provided
51+
* variables mapped to the set LLM provider. This endpoint abstracts the need to
52+
* handle mapping between different providers, while still allowing direct calls to
53+
* the providers.
5354
*/
5455
getParameters(
5556
id: string,
@@ -454,7 +455,7 @@ export interface PromptConfiguration {
454455
export namespace PromptConfiguration {
455456
export interface Message {
456457
content: Array<
457-
| Message.TextContentBlockSchema
458+
| Message.TextContentBlock
458459
| Message.ImageBase64ContentBlock
459460
| Message.ToolCallContentBlock
460461
| Message.ToolResultContentBlock
@@ -464,7 +465,7 @@ export namespace PromptConfiguration {
464465
}
465466

466467
export namespace Message {
467-
export interface TextContentBlockSchema {
468+
export interface TextContentBlock {
468469
text: string;
469470

470471
type: 'TEXT';
@@ -538,14 +539,9 @@ export namespace PromptConfiguration {
538539
maxTokens: number | null;
539540

540541
/**
541-
* Example: "gpt-3.5-turbo"
542+
* The name of the model for the provider.
542543
*/
543-
modelName: string;
544-
545-
/**
546-
* The provider of the provided model.
547-
*/
548-
modelProvider: 'ANTHROPIC' | 'OPENAI';
544+
name: string;
549545

550546
parallelToolCalls: boolean;
551547

@@ -554,6 +550,11 @@ export namespace PromptConfiguration {
554550
*/
555551
presencePenalty: number;
556552

553+
/**
554+
* The LLM model provider.
555+
*/
556+
provider: 'ANTHROPIC' | 'OPENAI';
557+
557558
/**
558559
* Example: PromptResponseFormat.TEXT
559560
*/
@@ -630,7 +631,7 @@ export interface PromptCreateParams {
630631
export namespace PromptCreateParams {
631632
export interface Message {
632633
content: Array<
633-
| Message.TextContentBlockSchema
634+
| Message.TextContentBlock
634635
| Message.ImageBase64ContentBlock
635636
| Message.ToolCallContentBlock
636637
| Message.ToolResultContentBlock
@@ -642,7 +643,7 @@ export namespace PromptCreateParams {
642643
}
643644

644645
export namespace Message {
645-
export interface TextContentBlockSchema {
646+
export interface TextContentBlock {
646647
text: string;
647648

648649
type: 'TEXT';
@@ -716,14 +717,9 @@ export namespace PromptCreateParams {
716717
maxTokens: number | null;
717718

718719
/**
719-
* Example: "gpt-3.5-turbo"
720+
* The name of the model for the provider.
720721
*/
721-
modelName: string;
722-
723-
/**
724-
* The provider of the provided model.
725-
*/
726-
modelProvider: 'ANTHROPIC' | 'OPENAI';
722+
name: string;
727723

728724
parallelToolCalls: boolean;
729725

@@ -732,6 +728,11 @@ export namespace PromptCreateParams {
732728
*/
733729
presencePenalty: number;
734730

731+
/**
732+
* The LLM model provider.
733+
*/
734+
provider: 'ANTHROPIC' | 'OPENAI';
735+
735736
/**
736737
* Example: PromptResponseFormat.TEXT
737738
*/
@@ -780,7 +781,7 @@ export interface PromptUpdateParams {
780781
export namespace PromptUpdateParams {
781782
export interface Message {
782783
content: Array<
783-
| Message.TextContentBlockSchema
784+
| Message.TextContentBlock
784785
| Message.ImageBase64ContentBlock
785786
| Message.ToolCallContentBlock
786787
| Message.ToolResultContentBlock
@@ -792,7 +793,7 @@ export namespace PromptUpdateParams {
792793
}
793794

794795
export namespace Message {
795-
export interface TextContentBlockSchema {
796+
export interface TextContentBlock {
796797
text: string;
797798

798799
type: 'TEXT';
@@ -866,14 +867,9 @@ export namespace PromptUpdateParams {
866867
maxTokens: number | null;
867868

868869
/**
869-
* Example: "gpt-3.5-turbo"
870-
*/
871-
modelName: string;
872-
873-
/**
874-
* The provider of the provided model.
870+
* The name of the model for the provider.
875871
*/
876-
modelProvider: 'ANTHROPIC' | 'OPENAI';
872+
name: string;
877873

878874
parallelToolCalls: boolean;
879875

@@ -882,6 +878,11 @@ export namespace PromptUpdateParams {
882878
*/
883879
presencePenalty: number;
884880

881+
/**
882+
* The LLM model provider.
883+
*/
884+
provider: 'ANTHROPIC' | 'OPENAI';
885+
885886
/**
886887
* Example: PromptResponseFormat.TEXT
887888
*/
@@ -944,7 +945,7 @@ export interface PromptGetParametersParams {
944945
export namespace PromptGetParametersParams {
945946
export interface AppendMessage {
946947
content: Array<
947-
| AppendMessage.TextContentBlockSchema
948+
| AppendMessage.TextContentBlock
948949
| AppendMessage.ImageBase64ContentBlock
949950
| AppendMessage.ToolCallContentBlock
950951
| AppendMessage.ToolResultContentBlock
@@ -954,7 +955,7 @@ export namespace PromptGetParametersParams {
954955
}
955956

956957
export namespace AppendMessage {
957-
export interface TextContentBlockSchema {
958+
export interface TextContentBlock {
958959
text: string;
959960

960961
type: 'TEXT';
@@ -1018,7 +1019,7 @@ export namespace PromptGetParametersParams {
10181019

10191020
export interface OverrideMessage {
10201021
content: Array<
1021-
| OverrideMessage.TextContentBlockSchema
1022+
| OverrideMessage.TextContentBlock
10221023
| OverrideMessage.ImageBase64ContentBlock
10231024
| OverrideMessage.ToolCallContentBlock
10241025
| OverrideMessage.ToolResultContentBlock
@@ -1028,7 +1029,7 @@ export namespace PromptGetParametersParams {
10281029
}
10291030

10301031
export namespace OverrideMessage {
1031-
export interface TextContentBlockSchema {
1032+
export interface TextContentBlock {
10321033
text: string;
10331034

10341035
type: 'TEXT';

tests/api-resources/prompts.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ describe('resource prompts', () => {
4242
],
4343
name: 'name',
4444
parameters: {
45-
modelProvider: 'ANTHROPIC',
46-
modelName: 'modelName',
45+
provider: 'ANTHROPIC',
46+
name: 'name',
4747
responseFormat: 'JSON',
4848
temperature: 0,
4949
topP: 0,
@@ -100,8 +100,8 @@ describe('resource prompts', () => {
100100
],
101101
name: 'name',
102102
parameters: {
103-
modelProvider: 'ANTHROPIC',
104-
modelName: 'modelName',
103+
provider: 'ANTHROPIC',
104+
name: 'name',
105105
responseFormat: 'JSON',
106106
temperature: 0,
107107
topP: 0,
@@ -151,8 +151,8 @@ describe('resource prompts', () => {
151151
],
152152
name: 'name',
153153
parameters: {
154-
modelProvider: 'ANTHROPIC',
155-
modelName: 'modelName',
154+
provider: 'ANTHROPIC',
155+
name: 'name',
156156
responseFormat: 'JSON',
157157
temperature: 0,
158158
topP: 0,
@@ -209,8 +209,8 @@ describe('resource prompts', () => {
209209
],
210210
name: 'name',
211211
parameters: {
212-
modelProvider: 'ANTHROPIC',
213-
modelName: 'modelName',
212+
provider: 'ANTHROPIC',
213+
name: 'name',
214214
responseFormat: 'JSON',
215215
temperature: 0,
216216
topP: 0,

0 commit comments

Comments
 (0)