Skip to content

Commit

Permalink
docs(examples): update example values (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jul 11, 2024
1 parent fe84709 commit acc7803
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 142 deletions.
2 changes: 1 addition & 1 deletion tests/api-resources/audio/speech.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('resource speech', () => {
// binary tests are currently broken
test.skip('create: required and optional params', async () => {
const response = await openai.audio.speech.create({
input: 'string',
input: 'input',
model: 'string',
voice: 'alloy',
response_format: 'mp3',
Expand Down
4 changes: 2 additions & 2 deletions tests/api-resources/audio/transcriptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ describe('resource transcriptions', () => {
const response = await openai.audio.transcriptions.create({
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
model: 'whisper-1',
language: 'string',
prompt: 'string',
language: 'language',
prompt: 'prompt',
response_format: 'json',
temperature: 0,
timestamp_granularities: ['word', 'segment'],
Expand Down
4 changes: 2 additions & 2 deletions tests/api-resources/audio/translations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ describe('resource translations', () => {
const response = await openai.audio.translations.create({
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
model: 'whisper-1',
prompt: 'string',
response_format: 'string',
prompt: 'prompt',
response_format: 'response_format',
temperature: 0,
});
});
Expand Down
14 changes: 7 additions & 7 deletions tests/api-resources/batches.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('resource batches', () => {
const responsePromise = openai.batches.create({
completion_window: '24h',
endpoint: '/v1/chat/completions',
input_file_id: 'string',
input_file_id: 'input_file_id',
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -28,13 +28,13 @@ describe('resource batches', () => {
const response = await openai.batches.create({
completion_window: '24h',
endpoint: '/v1/chat/completions',
input_file_id: 'string',
input_file_id: 'input_file_id',
metadata: { foo: 'string' },
});
});

test('retrieve', async () => {
const responsePromise = openai.batches.retrieve('string');
const responsePromise = openai.batches.retrieve('batch_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -46,7 +46,7 @@ describe('resource batches', () => {

test('retrieve: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(openai.batches.retrieve('string', { path: '/_stainless_unknown_path' })).rejects.toThrow(
await expect(openai.batches.retrieve('batch_id', { path: '/_stainless_unknown_path' })).rejects.toThrow(
OpenAI.NotFoundError,
);
});
Expand All @@ -72,12 +72,12 @@ describe('resource batches', () => {
test('list: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
openai.batches.list({ after: 'string', limit: 0 }, { path: '/_stainless_unknown_path' }),
openai.batches.list({ after: 'after', limit: 0 }, { path: '/_stainless_unknown_path' }),
).rejects.toThrow(OpenAI.NotFoundError);
});

test('cancel', async () => {
const responsePromise = openai.batches.cancel('string');
const responsePromise = openai.batches.cancel('batch_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -89,7 +89,7 @@ describe('resource batches', () => {

test('cancel: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(openai.batches.cancel('string', { path: '/_stainless_unknown_path' })).rejects.toThrow(
await expect(openai.batches.cancel('batch_id', { path: '/_stainless_unknown_path' })).rejects.toThrow(
OpenAI.NotFoundError,
);
});
Expand Down
22 changes: 11 additions & 11 deletions tests/api-resources/beta/assistants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ describe('resource assistants', () => {
test('create: required and optional params', async () => {
const response = await openai.beta.assistants.create({
model: 'gpt-4-turbo',
description: 'string',
instructions: 'string',
description: 'description',
instructions: 'instructions',
metadata: {},
name: 'string',
name: 'name',
response_format: 'none',
temperature: 1,
tool_resources: {
Expand All @@ -44,7 +44,7 @@ describe('resource assistants', () => {
});

test('retrieve', async () => {
const responsePromise = openai.beta.assistants.retrieve('string');
const responsePromise = openai.beta.assistants.retrieve('assistant_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -57,12 +57,12 @@ describe('resource assistants', () => {
test('retrieve: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
openai.beta.assistants.retrieve('string', { path: '/_stainless_unknown_path' }),
openai.beta.assistants.retrieve('assistant_id', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(OpenAI.NotFoundError);
});

test('update', async () => {
const responsePromise = openai.beta.assistants.update('string', {});
const responsePromise = openai.beta.assistants.update('assistant_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand Down Expand Up @@ -94,14 +94,14 @@ describe('resource assistants', () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
openai.beta.assistants.list(
{ after: 'string', before: 'string', limit: 0, order: 'asc' },
{ after: 'after', before: 'before', limit: 0, order: 'asc' },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(OpenAI.NotFoundError);
});

test('del', async () => {
const responsePromise = openai.beta.assistants.del('string');
const responsePromise = openai.beta.assistants.del('assistant_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -113,8 +113,8 @@ describe('resource assistants', () => {

test('del: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(openai.beta.assistants.del('string', { path: '/_stainless_unknown_path' })).rejects.toThrow(
OpenAI.NotFoundError,
);
await expect(
openai.beta.assistants.del('assistant_id', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(OpenAI.NotFoundError);
});
});
28 changes: 14 additions & 14 deletions tests/api-resources/beta/threads/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const openai = new OpenAI({

describe('resource messages', () => {
test('create: only required params', async () => {
const responsePromise = openai.beta.threads.messages.create('string', {
const responsePromise = openai.beta.threads.messages.create('thread_id', {
content: 'string',
role: 'user',
});
Expand All @@ -24,20 +24,20 @@ describe('resource messages', () => {
});

test('create: required and optional params', async () => {
const response = await openai.beta.threads.messages.create('string', {
const response = await openai.beta.threads.messages.create('thread_id', {
content: 'string',
role: 'user',
attachments: [
{
file_id: 'string',
file_id: 'file_id',
tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }],
},
{
file_id: 'string',
file_id: 'file_id',
tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }],
},
{
file_id: 'string',
file_id: 'file_id',
tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }],
},
],
Expand All @@ -46,7 +46,7 @@ describe('resource messages', () => {
});

test('retrieve', async () => {
const responsePromise = openai.beta.threads.messages.retrieve('string', 'string');
const responsePromise = openai.beta.threads.messages.retrieve('thread_id', 'message_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -59,12 +59,12 @@ describe('resource messages', () => {
test('retrieve: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
openai.beta.threads.messages.retrieve('string', 'string', { path: '/_stainless_unknown_path' }),
openai.beta.threads.messages.retrieve('thread_id', 'message_id', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(OpenAI.NotFoundError);
});

test('update', async () => {
const responsePromise = openai.beta.threads.messages.update('string', 'string', {});
const responsePromise = openai.beta.threads.messages.update('thread_id', 'message_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -75,7 +75,7 @@ describe('resource messages', () => {
});

test('list', async () => {
const responsePromise = openai.beta.threads.messages.list('string');
const responsePromise = openai.beta.threads.messages.list('thread_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -88,23 +88,23 @@ describe('resource messages', () => {
test('list: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
openai.beta.threads.messages.list('string', { path: '/_stainless_unknown_path' }),
openai.beta.threads.messages.list('thread_id', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(OpenAI.NotFoundError);
});

test('list: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
openai.beta.threads.messages.list(
'string',
{ after: 'string', before: 'string', limit: 0, order: 'asc', run_id: 'string' },
'thread_id',
{ after: 'after', before: 'before', limit: 0, order: 'asc', run_id: 'run_id' },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(OpenAI.NotFoundError);
});

test('del', async () => {
const responsePromise = openai.beta.threads.messages.del('string', 'string');
const responsePromise = openai.beta.threads.messages.del('thread_id', 'message_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -117,7 +117,7 @@ describe('resource messages', () => {
test('del: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
openai.beta.threads.messages.del('string', 'string', { path: '/_stainless_unknown_path' }),
openai.beta.threads.messages.del('thread_id', 'message_id', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(OpenAI.NotFoundError);
});
});
Loading

0 comments on commit acc7803

Please sign in to comment.