Skip to content

Commit

Permalink
docs(api): updates to API spec (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Feb 10, 2025
1 parent 1cc0ea4 commit 2e690e2
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 29
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-6a4042c053accc87fd10b42e19e8ebe27b81127cf6ff8aa246d7f30bc6b8776f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-5d57be55ac24a66e8c78594a3a964a90f12f98fc51f8c758891ec7fee2b74c9f.yml
6 changes: 4 additions & 2 deletions src/resources/applications/applications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ export interface ApplicationRetrieveResponse {
name: string;

/**
* Current deployment status of the application.
* Current deployment status of the application. Note: currently only `deployed`
* applications are returned.
*/
status: 'deployed' | 'draft';

Expand Down Expand Up @@ -322,7 +323,8 @@ export interface ApplicationListResponse {
name: string;

/**
* Current deployment status of the application.
* Current deployment status of the application. Note: currently only `deployed`
* applications are returned.
*/
status: 'deployed' | 'draft';

Expand Down
40 changes: 36 additions & 4 deletions src/resources/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ export namespace ChatCompletionChunk {

graph_data?: Shared.GraphData;

llm_data?: Delta.LlmData;

refusal?: string | null;

/**
Expand All @@ -203,6 +205,20 @@ export namespace ChatCompletionChunk {

tool_calls?: Array<Shared.ToolCallStreaming> | null;
}

export namespace Delta {
export interface LlmData {
/**
* The model used by the tool.
*/
model: string;

/**
* The prompt processed by the model.
*/
prompt: string;
}
}
}
}

Expand All @@ -226,9 +242,25 @@ export interface ChatCompletionMessage {

graph_data?: Shared.GraphData;

llm_data?: ChatCompletionMessage.LlmData;

tool_calls?: Array<Shared.ToolCall> | null;
}

export namespace ChatCompletionMessage {
export interface LlmData {
/**
* The model used by the tool.
*/
model: string;

/**
* The prompt processed by the model.
*/
prompt: string;
}
}

export interface ChatCompletionParams {
/**
* An array of message objects that form the conversation history or context for
Expand Down Expand Up @@ -296,8 +328,8 @@ export interface ChatCompletionParams {

/**
* An array of tools described to the model using JSON schema that the model can
* use to generate responses. Passing graph IDs will automatically use the
* Knowledge Graph tool.
* use to generate responses. You can define your own functions or use the built-in
* `graph` or `llm` tools.
*/
tools?: Array<Shared.ToolParam>;

Expand Down Expand Up @@ -433,8 +465,8 @@ export interface ChatChatParamsBase {

/**
* An array of tools described to the model using JSON schema that the model can
* use to generate responses. Passing graph IDs will automatically use the
* Knowledge Graph tool.
* use to generate responses. You can define your own functions or use the built-in
* `graph` or `llm` tools.
*/
tools?: Array<Shared.ToolParam>;

Expand Down
53 changes: 50 additions & 3 deletions src/resources/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,29 @@ export interface ErrorObject {
tpe: string;
}

/**
* A tool that uses a custom function.
*/
export interface FunctionDefinition {
/**
* Name of the function
* Name of the function.
*/
name: string;

/**
* Description of the function
* Description of the function.
*/
description?: string;

/**
* The parameters of the function.
*/
parameters?: FunctionParams;
}

/**
* The parameters of the function.
*/
export type FunctionParams = Record<string, unknown>;

export interface GraphData {
Expand Down Expand Up @@ -144,10 +153,13 @@ export interface ToolChoiceString {
value: 'none' | 'auto' | 'required';
}

export type ToolParam = ToolParam.FunctionTool | ToolParam.GraphTool;
export type ToolParam = ToolParam.FunctionTool | ToolParam.GraphTool | ToolParam.LlmTool;

export namespace ToolParam {
export interface FunctionTool {
/**
* A tool that uses a custom function.
*/
function: Shared.FunctionDefinition;

/**
Expand All @@ -157,6 +169,9 @@ export namespace ToolParam {
}

export interface GraphTool {
/**
* A tool that uses Knowledge Graphs as context for responses.
*/
function: GraphTool.Function;

/**
Expand All @@ -166,6 +181,9 @@ export namespace ToolParam {
}

export namespace GraphTool {
/**
* A tool that uses Knowledge Graphs as context for responses.
*/
export interface Function {
/**
* An array of graph IDs to be used in the tool.
Expand All @@ -183,4 +201,33 @@ export namespace ToolParam {
description?: string;
}
}

export interface LlmTool {
/**
* A tool that uses another Writer model to generate a response.
*/
function: LlmTool.Function;

/**
* The type of tool.
*/
type?: 'llm';
}

export namespace LlmTool {
/**
* A tool that uses another Writer model to generate a response.
*/
export interface Function {
/**
* A description of the model to be used.
*/
description: string;

/**
* The model to be used.
*/
model: string;
}
}
}

0 comments on commit 2e690e2

Please sign in to comment.