Skip to content

Commit 6b2ae48

Browse files
feat(api): OpenAPI spec update via Stainless API (#236)
1 parent eec77a9 commit 6b2ae48

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-84eb1e848fd165a965df78740df71651a8b413f023e5fdb6eb1acb9cce08e006.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,
@@ -452,7 +453,7 @@ export interface PromptConfiguration {
452453
export namespace PromptConfiguration {
453454
export interface Message {
454455
content: Array<
455-
| Message.TextContentBlockSchema
456+
| Message.TextContentBlock
456457
| Message.ImageBase64ContentBlock
457458
| Message.ToolCallContentBlock
458459
| Message.ToolResultContentBlock
@@ -462,7 +463,7 @@ export namespace PromptConfiguration {
462463
}
463464

464465
export namespace Message {
465-
export interface TextContentBlockSchema {
466+
export interface TextContentBlock {
466467
text: string;
467468

468469
type: 'TEXT';
@@ -536,14 +537,9 @@ export namespace PromptConfiguration {
536537
maxTokens: number | null;
537538

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

548544
parallelToolCalls: boolean;
549545

@@ -552,6 +548,11 @@ export namespace PromptConfiguration {
552548
*/
553549
presencePenalty: number;
554550

551+
/**
552+
* The LLM model provider.
553+
*/
554+
provider: 'ANTHROPIC' | 'OPENAI';
555+
555556
/**
556557
* Example: PromptResponseFormat.TEXT
557558
*/
@@ -628,7 +629,7 @@ export interface PromptCreateParams {
628629
export namespace PromptCreateParams {
629630
export interface Message {
630631
content: Array<
631-
| Message.TextContentBlockSchema
632+
| Message.TextContentBlock
632633
| Message.ImageBase64ContentBlock
633634
| Message.ToolCallContentBlock
634635
| Message.ToolResultContentBlock
@@ -640,7 +641,7 @@ export namespace PromptCreateParams {
640641
}
641642

642643
export namespace Message {
643-
export interface TextContentBlockSchema {
644+
export interface TextContentBlock {
644645
text: string;
645646

646647
type: 'TEXT';
@@ -714,14 +715,9 @@ export namespace PromptCreateParams {
714715
maxTokens: number | null;
715716

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

726722
parallelToolCalls: boolean;
727723

@@ -730,6 +726,11 @@ export namespace PromptCreateParams {
730726
*/
731727
presencePenalty: number;
732728

729+
/**
730+
* The LLM model provider.
731+
*/
732+
provider: 'ANTHROPIC' | 'OPENAI';
733+
733734
/**
734735
* Example: PromptResponseFormat.TEXT
735736
*/
@@ -778,7 +779,7 @@ export interface PromptUpdateParams {
778779
export namespace PromptUpdateParams {
779780
export interface Message {
780781
content: Array<
781-
| Message.TextContentBlockSchema
782+
| Message.TextContentBlock
782783
| Message.ImageBase64ContentBlock
783784
| Message.ToolCallContentBlock
784785
| Message.ToolResultContentBlock
@@ -790,7 +791,7 @@ export namespace PromptUpdateParams {
790791
}
791792

792793
export namespace Message {
793-
export interface TextContentBlockSchema {
794+
export interface TextContentBlock {
794795
text: string;
795796

796797
type: 'TEXT';
@@ -864,14 +865,9 @@ export namespace PromptUpdateParams {
864865
maxTokens: number | null;
865866

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

876872
parallelToolCalls: boolean;
877873

@@ -880,6 +876,11 @@ export namespace PromptUpdateParams {
880876
*/
881877
presencePenalty: number;
882878

879+
/**
880+
* The LLM model provider.
881+
*/
882+
provider: 'ANTHROPIC' | 'OPENAI';
883+
883884
/**
884885
* Example: PromptResponseFormat.TEXT
885886
*/
@@ -942,7 +943,7 @@ export interface PromptGetParametersParams {
942943
export namespace PromptGetParametersParams {
943944
export interface AppendMessage {
944945
content: Array<
945-
| AppendMessage.TextContentBlockSchema
946+
| AppendMessage.TextContentBlock
946947
| AppendMessage.ImageBase64ContentBlock
947948
| AppendMessage.ToolCallContentBlock
948949
| AppendMessage.ToolResultContentBlock
@@ -952,7 +953,7 @@ export namespace PromptGetParametersParams {
952953
}
953954

954955
export namespace AppendMessage {
955-
export interface TextContentBlockSchema {
956+
export interface TextContentBlock {
956957
text: string;
957958

958959
type: 'TEXT';
@@ -1016,7 +1017,7 @@ export namespace PromptGetParametersParams {
10161017

10171018
export interface OverrideMessage {
10181019
content: Array<
1019-
| OverrideMessage.TextContentBlockSchema
1020+
| OverrideMessage.TextContentBlock
10201021
| OverrideMessage.ImageBase64ContentBlock
10211022
| OverrideMessage.ToolCallContentBlock
10221023
| OverrideMessage.ToolResultContentBlock
@@ -1026,7 +1027,7 @@ export namespace PromptGetParametersParams {
10261027
}
10271028

10281029
export namespace OverrideMessage {
1029-
export interface TextContentBlockSchema {
1030+
export interface TextContentBlock {
10301031
text: string;
10311032

10321033
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)