Skip to content

Commit

Permalink
docs(api): updates to API spec (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Feb 14, 2025
1 parent 3c75a29 commit e08f812
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 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-710e8a17bc916b755685592b3831e6732f3ba02904f970084aef0ac86fd79ed5.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-9f17b2629bd54f56bc3e48ec710b11e2ba84302725f8da9e9ed390bbed5d3b5b.yml
4 changes: 2 additions & 2 deletions src/resources/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export namespace ChatCompletionChunk {

graph_data?: Shared.GraphData;

llm_data?: Delta.LlmData;
llm_data?: Delta.LlmData | null;

refusal?: string | null;

Expand Down Expand Up @@ -242,7 +242,7 @@ export interface ChatCompletionMessage {

graph_data?: Shared.GraphData;

llm_data?: ChatCompletionMessage.LlmData;
llm_data?: ChatCompletionMessage.LlmData | null;

tool_calls?: Array<Shared.ToolCall> | null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export namespace Completion {
*/
text: string;

log_probs?: Shared.Logprobs;
log_probs?: Shared.Logprobs | null;
}
}

Expand Down
28 changes: 16 additions & 12 deletions src/resources/graphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Graphs extends APIResource {
}

/**
* Update graph
* Update the name and description of a Knowledge Graph.
*/
update(
graphId: string,
Expand Down Expand Up @@ -186,9 +186,9 @@ export interface Question {
*/
question: string;

sources: Array<Shared.Source>;
sources: Array<Shared.Source | null>;

subqueries?: Array<Question.Subquery>;
subqueries?: Array<Question.Subquery | null>;
}

export namespace Question {
Expand All @@ -203,7 +203,7 @@ export namespace Question {
*/
query: string;

sources: Array<Shared.Source>;
sources: Array<Shared.Source | null>;
}
}

Expand Down Expand Up @@ -281,26 +281,30 @@ export interface GraphRemoveFileFromGraphResponse {

export interface GraphCreateParams {
/**
* The name of the graph. This can be at most 255 characters.
* A description of the graph (max 255 characters). Omitting this field leaves the
* description unchanged.
*/
name: string;
description?: string;

/**
* A description of the graph. This can be at most 255 characters.
* The name of the graph (max 255 characters). Omitting this field leaves the name
* unchanged.
*/
description?: string;
name?: string;
}

export interface GraphUpdateParams {
/**
* The name of the graph. This can be at most 255 characters.
* A description of the graph (max 255 characters). Omitting this field leaves the
* description unchanged.
*/
name: string;
description?: string;

/**
* A description of the graph. This can be at most 255 characters.
* The name of the graph (max 255 characters). Omitting this field leaves the name
* unchanged.
*/
description?: string;
name?: string;
}

export interface GraphListParams extends CursorPageParams {
Expand Down
8 changes: 4 additions & 4 deletions src/resources/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export interface FunctionDefinition {
export type FunctionParams = Record<string, unknown>;

export interface GraphData {
sources?: Array<Source>;
sources?: Array<Source | null>;

status?: 'processing' | 'finished';
status?: 'processing' | 'finished' | null;

subqueries?: Array<GraphData.Subquery>;
subqueries?: Array<GraphData.Subquery | null>;
}

export namespace GraphData {
Expand All @@ -63,7 +63,7 @@ export namespace GraphData {
*/
query: string;

sources: Array<Shared.Source>;
sources: Array<Shared.Source | null>;
}
}

Expand Down
19 changes: 4 additions & 15 deletions tests/api-resources/graphs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const client = new Writer({
});

describe('resource graphs', () => {
test('create: only required params', async () => {
const responsePromise = client.graphs.create({ name: 'name' });
test('create', async () => {
const responsePromise = client.graphs.create({});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -20,10 +20,6 @@ describe('resource graphs', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});

test('create: required and optional params', async () => {
const response = await client.graphs.create({ name: 'name', description: 'description' });
});

test('retrieve', async () => {
const responsePromise = client.graphs.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
const rawResponse = await responsePromise.asResponse();
Expand All @@ -42,8 +38,8 @@ describe('resource graphs', () => {
).rejects.toThrow(Writer.NotFoundError);
});

test('update: only required params', async () => {
const responsePromise = client.graphs.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { name: 'name' });
test('update', async () => {
const responsePromise = client.graphs.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -53,13 +49,6 @@ describe('resource graphs', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});

test('update: required and optional params', async () => {
const response = await client.graphs.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
name: 'name',
description: 'description',
});
});

test('list', async () => {
const responsePromise = client.graphs.list();
const rawResponse = await responsePromise.asResponse();
Expand Down

0 comments on commit e08f812

Please sign in to comment.