Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-9cff8ea13f14bd0899df69243fe78b4f88d4d0172263aa260af1ea66a7d0484e.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-84eb1e848fd165a965df78740df71651a8b413f023e5fdb6eb1acb9cce08e006.yml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const { data: completionCreateResponse, response: raw } = await client.completio
.create('1212121')
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(completionCreateResponse.message);
console.log(completionCreateResponse.provider);
```

### Making custom/undocumented requests
Expand Down
19 changes: 13 additions & 6 deletions src/resources/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export interface CompletionCreateResponse {
*/
message: CompletionCreateResponse.Message;

name: string;

/**
* The LLM model provider.
*/
provider: 'ANTHROPIC' | 'OPENAI';

stats: CompletionCreateResponse.Stats;
}

Expand All @@ -45,7 +52,7 @@ export namespace CompletionCreateResponse {
*/
export interface Message {
content: Array<
| Message.TextContentBlockSchema
| Message.TextContentBlock
| Message.ImageBase64ContentBlock
| Message.ToolCallContentBlock
| Message.ToolResultContentBlock
Expand All @@ -55,7 +62,7 @@ export namespace CompletionCreateResponse {
}

export namespace Message {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down Expand Up @@ -167,7 +174,7 @@ export interface CompletionCreateParams {
export namespace CompletionCreateParams {
export interface AppendMessage {
content: Array<
| AppendMessage.TextContentBlockSchema
| AppendMessage.TextContentBlock
| AppendMessage.ImageBase64ContentBlock
| AppendMessage.ToolCallContentBlock
| AppendMessage.ToolResultContentBlock
Expand All @@ -177,7 +184,7 @@ export namespace CompletionCreateParams {
}

export namespace AppendMessage {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down Expand Up @@ -241,7 +248,7 @@ export namespace CompletionCreateParams {

export interface OverrideMessage {
content: Array<
| OverrideMessage.TextContentBlockSchema
| OverrideMessage.TextContentBlock
| OverrideMessage.ImageBase64ContentBlock
| OverrideMessage.ToolCallContentBlock
| OverrideMessage.ToolResultContentBlock
Expand All @@ -251,7 +258,7 @@ export namespace CompletionCreateParams {
}

export namespace OverrideMessage {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down
12 changes: 6 additions & 6 deletions src/resources/evaluations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface Evaluation {
export namespace Evaluation {
export interface AppendedMessage {
content: Array<
| AppendedMessage.TextContentBlockSchema
| AppendedMessage.TextContentBlock
| AppendedMessage.ImageBase64ContentBlock
| AppendedMessage.ToolCallContentBlock
| AppendedMessage.ToolResultContentBlock
Expand All @@ -84,7 +84,7 @@ export namespace Evaluation {
}

export namespace AppendedMessage {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down Expand Up @@ -180,7 +180,7 @@ export interface EvaluationCreateParams {
export namespace EvaluationCreateParams {
export interface AppendedMessage {
content: Array<
| AppendedMessage.TextContentBlockSchema
| AppendedMessage.TextContentBlock
| AppendedMessage.ImageBase64ContentBlock
| AppendedMessage.ToolCallContentBlock
| AppendedMessage.ToolResultContentBlock
Expand All @@ -190,7 +190,7 @@ export namespace EvaluationCreateParams {
}

export namespace AppendedMessage {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down Expand Up @@ -280,7 +280,7 @@ export interface EvaluationUpdateParams {
export namespace EvaluationUpdateParams {
export interface AppendedMessage {
content: Array<
| AppendedMessage.TextContentBlockSchema
| AppendedMessage.TextContentBlock
| AppendedMessage.ImageBase64ContentBlock
| AppendedMessage.ToolCallContentBlock
| AppendedMessage.ToolResultContentBlock
Expand All @@ -290,7 +290,7 @@ export namespace EvaluationUpdateParams {
}

export namespace AppendedMessage {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down
69 changes: 35 additions & 34 deletions src/resources/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ export class Prompts extends APIResource {
}

/**
* Fetches the model configuration parameters for a specified prompt, including
* penalty settings, response format, and the model messages rendered with the
* given variables mapped to the set LLM provider.
* Fetches the configured model parameters and messages rendered with the provided
* variables mapped to the set LLM provider. This endpoint abstracts the need to
* handle mapping between different providers, while still allowing direct calls to
* the providers.
*/
getParameters(
id: string,
Expand Down Expand Up @@ -452,7 +453,7 @@ export interface PromptConfiguration {
export namespace PromptConfiguration {
export interface Message {
content: Array<
| Message.TextContentBlockSchema
| Message.TextContentBlock
| Message.ImageBase64ContentBlock
| Message.ToolCallContentBlock
| Message.ToolResultContentBlock
Expand All @@ -462,7 +463,7 @@ export namespace PromptConfiguration {
}

export namespace Message {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down Expand Up @@ -536,14 +537,9 @@ export namespace PromptConfiguration {
maxTokens: number | null;

/**
* Example: "gpt-3.5-turbo"
* The name of the model for the provider.
*/
modelName: string;

/**
* The provider of the provided model.
*/
modelProvider: 'ANTHROPIC' | 'OPENAI';
name: string;

parallelToolCalls: boolean;

Expand All @@ -552,6 +548,11 @@ export namespace PromptConfiguration {
*/
presencePenalty: number;

/**
* The LLM model provider.
*/
provider: 'ANTHROPIC' | 'OPENAI';

/**
* Example: PromptResponseFormat.TEXT
*/
Expand Down Expand Up @@ -628,7 +629,7 @@ export interface PromptCreateParams {
export namespace PromptCreateParams {
export interface Message {
content: Array<
| Message.TextContentBlockSchema
| Message.TextContentBlock
| Message.ImageBase64ContentBlock
| Message.ToolCallContentBlock
| Message.ToolResultContentBlock
Expand All @@ -640,7 +641,7 @@ export namespace PromptCreateParams {
}

export namespace Message {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down Expand Up @@ -714,14 +715,9 @@ export namespace PromptCreateParams {
maxTokens: number | null;

/**
* Example: "gpt-3.5-turbo"
* The name of the model for the provider.
*/
modelName: string;

/**
* The provider of the provided model.
*/
modelProvider: 'ANTHROPIC' | 'OPENAI';
name: string;

parallelToolCalls: boolean;

Expand All @@ -730,6 +726,11 @@ export namespace PromptCreateParams {
*/
presencePenalty: number;

/**
* The LLM model provider.
*/
provider: 'ANTHROPIC' | 'OPENAI';

/**
* Example: PromptResponseFormat.TEXT
*/
Expand Down Expand Up @@ -778,7 +779,7 @@ export interface PromptUpdateParams {
export namespace PromptUpdateParams {
export interface Message {
content: Array<
| Message.TextContentBlockSchema
| Message.TextContentBlock
| Message.ImageBase64ContentBlock
| Message.ToolCallContentBlock
| Message.ToolResultContentBlock
Expand All @@ -790,7 +791,7 @@ export namespace PromptUpdateParams {
}

export namespace Message {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down Expand Up @@ -864,14 +865,9 @@ export namespace PromptUpdateParams {
maxTokens: number | null;

/**
* Example: "gpt-3.5-turbo"
*/
modelName: string;

/**
* The provider of the provided model.
* The name of the model for the provider.
*/
modelProvider: 'ANTHROPIC' | 'OPENAI';
name: string;

parallelToolCalls: boolean;

Expand All @@ -880,6 +876,11 @@ export namespace PromptUpdateParams {
*/
presencePenalty: number;

/**
* The LLM model provider.
*/
provider: 'ANTHROPIC' | 'OPENAI';

/**
* Example: PromptResponseFormat.TEXT
*/
Expand Down Expand Up @@ -942,7 +943,7 @@ export interface PromptGetParametersParams {
export namespace PromptGetParametersParams {
export interface AppendMessage {
content: Array<
| AppendMessage.TextContentBlockSchema
| AppendMessage.TextContentBlock
| AppendMessage.ImageBase64ContentBlock
| AppendMessage.ToolCallContentBlock
| AppendMessage.ToolResultContentBlock
Expand All @@ -952,7 +953,7 @@ export namespace PromptGetParametersParams {
}

export namespace AppendMessage {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down Expand Up @@ -1016,7 +1017,7 @@ export namespace PromptGetParametersParams {

export interface OverrideMessage {
content: Array<
| OverrideMessage.TextContentBlockSchema
| OverrideMessage.TextContentBlock
| OverrideMessage.ImageBase64ContentBlock
| OverrideMessage.ToolCallContentBlock
| OverrideMessage.ToolResultContentBlock
Expand All @@ -1026,7 +1027,7 @@ export namespace PromptGetParametersParams {
}

export namespace OverrideMessage {
export interface TextContentBlockSchema {
export interface TextContentBlock {
text: string;

type: 'TEXT';
Expand Down
16 changes: 8 additions & 8 deletions tests/api-resources/prompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe('resource prompts', () => {
],
name: 'name',
parameters: {
modelProvider: 'ANTHROPIC',
modelName: 'modelName',
provider: 'ANTHROPIC',
name: 'name',
responseFormat: 'JSON',
temperature: 0,
topP: 0,
Expand Down Expand Up @@ -100,8 +100,8 @@ describe('resource prompts', () => {
],
name: 'name',
parameters: {
modelProvider: 'ANTHROPIC',
modelName: 'modelName',
provider: 'ANTHROPIC',
name: 'name',
responseFormat: 'JSON',
temperature: 0,
topP: 0,
Expand Down Expand Up @@ -151,8 +151,8 @@ describe('resource prompts', () => {
],
name: 'name',
parameters: {
modelProvider: 'ANTHROPIC',
modelName: 'modelName',
provider: 'ANTHROPIC',
name: 'name',
responseFormat: 'JSON',
temperature: 0,
topP: 0,
Expand Down Expand Up @@ -209,8 +209,8 @@ describe('resource prompts', () => {
],
name: 'name',
parameters: {
modelProvider: 'ANTHROPIC',
modelName: 'modelName',
provider: 'ANTHROPIC',
name: 'name',
responseFormat: 'JSON',
temperature: 0,
topP: 0,
Expand Down