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: 18
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-b508bc085393c028e9caac93c923305a558a3f1b059bf990a712a69d4ef58dfa.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-94a38a74ceffcba2040259f19be51ccf509cb5b6560f094f5a2312a2ef1f78b1.yml
82 changes: 79 additions & 3 deletions src/resources/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,87 @@ export namespace ChatChatParams {
export interface Message {
role: 'user' | 'assistant' | 'system' | 'tool';

content?: string;
content?: string | null;

name?: string;
graph_data?: Message.GraphData | null;

tool_call_id?: string;
name?: string | null;

refusal?: string | null;

tool_call_id?: string | null;

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

export namespace Message {
export interface GraphData {
sources?: Array<GraphData.Source>;

status?: 'processing' | 'finished';

subqueries?: Array<GraphData.Subquery>;
}

export namespace GraphData {
export interface Source {
/**
* The unique identifier of the file.
*/
file_id: string;

/**
* A snippet of text from the source file.
*/
snippet: string;
}

export interface Subquery {
/**
* The answer to the subquery.
*/
answer: string;

/**
* The subquery that was asked.
*/
query: string;

sources: Array<Subquery.Source>;
}

export namespace Subquery {
export interface Source {
/**
* The unique identifier of the file.
*/
file_id: string;

/**
* A snippet of text from the source file.
*/
snippet: string;
}
}
}

export interface ToolCall {
id: string;

function: ToolCall.Function;

type: string;

index?: number;
}

export namespace ToolCall {
export interface Function {
arguments: string;

name: string;
}
}
}

/**
Expand Down
41 changes: 41 additions & 0 deletions tests/api-resources/chat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,49 @@ describe('resource chat', () => {
{
role: 'user',
content: 'Write a memo summarizing this earnings report.',
graph_data: {
sources: [
{ file_id: 'file_id', snippet: 'snippet' },
{ file_id: 'file_id', snippet: 'snippet' },
{ file_id: 'file_id', snippet: 'snippet' },
],
status: 'processing',
subqueries: [
{
answer: 'answer',
query: 'query',
sources: [
{ file_id: 'file_id', snippet: 'snippet' },
{ file_id: 'file_id', snippet: 'snippet' },
{ file_id: 'file_id', snippet: 'snippet' },
],
},
{
answer: 'answer',
query: 'query',
sources: [
{ file_id: 'file_id', snippet: 'snippet' },
{ file_id: 'file_id', snippet: 'snippet' },
{ file_id: 'file_id', snippet: 'snippet' },
],
},
{
answer: 'answer',
query: 'query',
sources: [
{ file_id: 'file_id', snippet: 'snippet' },
{ file_id: 'file_id', snippet: 'snippet' },
{ file_id: 'file_id', snippet: 'snippet' },
],
},
],
},
name: 'name',
refusal: 'refusal',
tool_call_id: 'tool_call_id',
tool_calls: [
{ id: 'id', function: { arguments: 'arguments', name: 'name' }, type: 'type', index: 0 },
],
},
],
model: 'palmyra-x-004',
Expand Down