Skip to content

Commit a149f12

Browse files
feat(api): api update
1 parent dac80cc commit a149f12

File tree

4 files changed

+62
-34
lines changed

4 files changed

+62
-34
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 28
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-3d6ba63951e80bd93c271b1803dc529a8e4e8d8872a0f597cabc1551a90c2e44.yml
3-
openapi_spec_hash: 87058bf8524b40e430c14ddbc1a7d94f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-c6e6dcd8ce01b0a968c343e0e3ec4d2aed526942ddc7c4f579044da6fdf460ec.yml
3+
openapi_spec_hash: 1ddbbad47d9cf85715279efbefd54199
44
config_hash: a60b100624e80dc8d9144e7bc306f5ce

src/resources/chat/completions.ts

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class Completions extends APIResource {
1616
* ```ts
1717
* const chatCompletion = await client.chat.completions.create(
1818
* {
19-
* messages: [{ content: 'string', role: 'system' }],
19+
* messages: [{ content: 'content', role: 'system' }],
2020
* model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
2121
* },
2222
* );
@@ -277,7 +277,13 @@ export interface CompletionCreateParamsBase {
277277
/**
278278
* A list of messages comprising the conversation so far.
279279
*/
280-
messages: Array<CompletionCreateParams.Message>;
280+
messages: Array<
281+
| CompletionCreateParams.ChatCompletionSystemMessageParam
282+
| CompletionCreateParams.ChatCompletionUserMessageParam
283+
| CompletionCreateParams.ChatCompletionAssistantMessageParam
284+
| CompletionCreateParams.ChatCompletionToolMessageParam
285+
| CompletionCreateParams.ChatCompletionFunctionMessageParam
286+
>;
281287

282288
/**
283289
* The name of the model to query.
@@ -424,41 +430,65 @@ export interface CompletionCreateParamsBase {
424430
}
425431

426432
export namespace CompletionCreateParams {
427-
export interface Message {
433+
export interface ChatCompletionSystemMessageParam {
434+
content: string;
435+
436+
role: 'system';
437+
438+
name?: string;
439+
}
440+
441+
export interface ChatCompletionUserMessageParam {
442+
content: string;
443+
444+
role: 'user';
445+
446+
name?: string;
447+
}
448+
449+
export interface ChatCompletionAssistantMessageParam {
450+
role: 'assistant';
451+
452+
content?: string | null;
453+
428454
/**
429-
* The content of the message, which can either be a simple string or a structured
430-
* format.
455+
* @deprecated
431456
*/
432-
content:
433-
| string
434-
| Array<
435-
| ChatCompletionsAPI.ChatCompletionStructuredMessageText
436-
| ChatCompletionsAPI.ChatCompletionStructuredMessageImageURL
437-
| Message.Video
438-
>;
457+
function_call?: ChatCompletionAssistantMessageParam.FunctionCall;
458+
459+
name?: string;
460+
461+
tool_calls?: Array<CompletionsAPI.ToolChoice>;
462+
}
439463

464+
export namespace ChatCompletionAssistantMessageParam {
440465
/**
441-
* The role of the messages author. Choice between: system, user, assistant, or
442-
* tool.
466+
* @deprecated
443467
*/
444-
role: 'system' | 'user' | 'assistant' | 'tool';
468+
export interface FunctionCall {
469+
arguments: string;
470+
471+
name: string;
472+
}
445473
}
446474

447-
export namespace Message {
448-
export interface Video {
449-
type: 'video_url';
475+
export interface ChatCompletionToolMessageParam {
476+
content: string;
450477

451-
video_url: Video.VideoURL;
452-
}
478+
role: 'tool';
453479

454-
export namespace Video {
455-
export interface VideoURL {
456-
/**
457-
* The URL of the video
458-
*/
459-
url: string;
460-
}
461-
}
480+
tool_call_id: string;
481+
}
482+
483+
/**
484+
* @deprecated
485+
*/
486+
export interface ChatCompletionFunctionMessageParam {
487+
content: string;
488+
489+
name: string;
490+
491+
role: 'function';
462492
}
463493

464494
export interface Name {

src/resources/chat/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ export {
1313
Completions,
1414
type ChatCompletion,
1515
type ChatCompletionChunk,
16-
type ChatCompletionStructuredMessageImageURL,
17-
type ChatCompletionStructuredMessageText,
1816
type ChatCompletionUsage,
1917
type CompletionCreateParams,
2018
type CompletionCreateParamsNonStreaming,

tests/api-resources/chat/completions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const client = new Together({
1111
describe('resource completions', () => {
1212
test('create: only required params', async () => {
1313
const responsePromise = client.chat.completions.create({
14-
messages: [{ content: 'string', role: 'system' }],
14+
messages: [{ content: 'content', role: 'system' }],
1515
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
1616
});
1717
const rawResponse = await responsePromise.asResponse();
@@ -25,7 +25,7 @@ describe('resource completions', () => {
2525

2626
test('create: required and optional params', async () => {
2727
const response = await client.chat.completions.create({
28-
messages: [{ content: 'string', role: 'system' }],
28+
messages: [{ content: 'content', role: 'system', name: 'name' }],
2929
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
3030
context_length_exceeded_behavior: 'truncate',
3131
echo: true,

0 commit comments

Comments
 (0)