Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
4677c82
codegen metadata
stainless-app[bot] Feb 4, 2026
26ebf87
codegen metadata
stainless-app[bot] Feb 4, 2026
f4049d5
codegen metadata
stainless-app[bot] Feb 4, 2026
1376258
fix(client): avoid removing abort listener too early
stainless-app[bot] Feb 5, 2026
f5a8b94
codegen metadata
stainless-app[bot] Feb 6, 2026
7fdfcca
chore: Update descriptions for jig queue methods and properties
stainless-app[bot] Feb 6, 2026
6df3f30
codegen metadata
stainless-app[bot] Feb 10, 2026
70ad44b
chore(internal): avoid type checking errors with ts-reset
stainless-app[bot] Feb 11, 2026
7365202
codegen metadata
stainless-app[bot] Feb 12, 2026
e7a8aaf
feat: Update descriptions for endpoints
stainless-app[bot] Feb 12, 2026
af4c47f
chore: Fix various docstrings
stainless-app[bot] Feb 17, 2026
d73f69f
chore(internal/client): fix form-urlencoded requests
stainless-app[bot] Feb 17, 2026
a0c187e
chore: Remove broken field LineCount from FileResponse
stainless-app[bot] Feb 18, 2026
03d5f94
codegen metadata
stainless-app[bot] Feb 19, 2026
b6f30b6
chore: configure new SDK language
stainless-app[bot] Feb 19, 2026
bb39360
chore: Revert adding mcp code. Code additions were unexpected.
stainless-app[bot] Feb 19, 2026
ac14bf7
chore: update mock server docs
stainless-app[bot] Feb 19, 2026
be7e0e7
fix(internal): skip tests that depend on mock server
stainless-app[bot] Feb 21, 2026
eab2b6e
fix(docs/contributing): correct pnpm link command
stainless-app[bot] Feb 23, 2026
703f103
codegen metadata
stainless-app[bot] Feb 23, 2026
54dc83f
chore(internal): move stringifyQuery implementation to internal function
stainless-app[bot] Feb 26, 2026
1d3a34e
feat: update deployments schemas to include volume versions
stainless-app[bot] Mar 2, 2026
7be3686
feat: Add typing for completion responses related to logprobs
stainless-app[bot] Mar 3, 2026
cb4bdcb
feat: Change TrainingType default to null
stainless-app[bot] Mar 4, 2026
71e55a9
feat: Add wandb_entity argument to OpenAPI definition
stainless-app[bot] Mar 4, 2026
52c3b77
feat: Update training type for price estimation too
stainless-app[bot] Mar 4, 2026
d59291f
feat: Another try
stainless-app[bot] Mar 4, 2026
11669ff
fix: fix request delays for retrying to be more respectful of high re…
stainless-app[bot] Mar 5, 2026
4f232bf
chore(test): do not count install time for mock server timeout
stainless-app[bot] Mar 5, 2026
eb83352
feat: Add FT models supported and limits
stainless-app[bot] Mar 6, 2026
2749638
codegen metadata
stainless-app[bot] Mar 6, 2026
603c86c
chore(ci): skip uploading artifacts on stainless-internal branches
stainless-app[bot] Mar 7, 2026
e481cda
chore: update placeholder string
stainless-app[bot] Mar 7, 2026
940974d
fix(client): preserve URL params already embedded in path
stainless-app[bot] Mar 7, 2026
e442dfd
chore(internal): update dependencies to address dependabot vulnerabil…
stainless-app[bot] Mar 9, 2026
4dac51b
fix: fixed autoscaling configs in deployments api
stainless-app[bot] Mar 10, 2026
021d571
codegen metadata
stainless-app[bot] Mar 12, 2026
5bd7444
feat: Update llama 3.1 8b w/ qwen 3.5 9b
stainless-app[bot] Mar 13, 2026
e8d66c5
chore(internal): tweak CI branches
stainless-app[bot] Mar 16, 2026
91a8c77
fix(types): change model to string in chat completions
stainless-app[bot] Mar 17, 2026
9ddb570
codegen metadata
stainless-app[bot] Mar 17, 2026
206ba6d
feat(api): manual updates
stainless-app[bot] Mar 18, 2026
eb817bf
feat(api): manual updates
stainless-app[bot] Mar 18, 2026
9fe1286
feat(api): manual updates
stainless-app[bot] Mar 18, 2026
2463a75
chore: Fix broken lint (#213)
blainekasten Mar 18, 2026
66bdf7e
release: 0.38.0
stainless-app[bot] Mar 18, 2026
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
22 changes: 14 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand Down Expand Up @@ -55,14 +57,18 @@ jobs:
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/togetherai-typescript'
if: |-
github.repository == 'stainless-sdks/togetherai-typescript' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/togetherai-typescript'
if: |-
github.repository == 'stainless-sdks/togetherai-typescript' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.37.0"
".": "0.38.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 75
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-dc45695614158674dec4da8ae843a7564905f24d2ce577e8e6e5246b4a7b0f61.yml
openapi_spec_hash: 46a91a84c8c270792676ee863b33ab99
config_hash: 67b76d1064bef2e591cadf50de08ad19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-31893d157d3c85caa1d8615b73a5fa431ea2cc126bd2410e0f84f3defd5c7dec.yml
openapi_spec_hash: b652a4d504b4a3dbf585ab803b0f59fc
config_hash: 52d213100a0ca1a4b2cdcd2718936b51
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# Changelog

## 0.38.0 (2026-03-18)

Full Changelog: [v0.37.0...v0.38.0](https://github.com/togethercomputer/together-typescript/compare/v0.37.0...v0.38.0)

### Features

* Add FT models supported and limits ([eb83352](https://github.com/togethercomputer/together-typescript/commit/eb83352895441dd6c7b14815bc56fa703bb21cb5))
* Add typing for completion responses related to logprobs ([7be3686](https://github.com/togethercomputer/together-typescript/commit/7be368608be937b1d212c285b4cfd7e3650c4213))
* Add wandb_entity argument to OpenAPI definition ([71e55a9](https://github.com/togethercomputer/together-typescript/commit/71e55a9852f68f467f210f858ef509888db9abed))
* Another try ([d59291f](https://github.com/togethercomputer/together-typescript/commit/d59291f9f6a185443214c1da6c333400b5c9a997))
* **api:** manual updates ([9fe1286](https://github.com/togethercomputer/together-typescript/commit/9fe1286feb663510d56245890237e0b618836be4))
* **api:** manual updates ([eb817bf](https://github.com/togethercomputer/together-typescript/commit/eb817bfbe1034925f5cf6f590fd6b9bc4f5fce51))
* **api:** manual updates ([206ba6d](https://github.com/togethercomputer/together-typescript/commit/206ba6dcc63ec4f638e99b71a65b34d4b4ba7b3c))
* Change TrainingType default to null ([cb4bdcb](https://github.com/togethercomputer/together-typescript/commit/cb4bdcb2cf4ed3d22d3b0e50135af1b8c80d6218))
* update deployments schemas to include volume versions ([1d3a34e](https://github.com/togethercomputer/together-typescript/commit/1d3a34efef57808b89b16ab39791f53380163385))
* Update descriptions for endpoints ([e7a8aaf](https://github.com/togethercomputer/together-typescript/commit/e7a8aafed811633b2a1c2c19df41fb43fd48ae89))
* Update llama 3.1 8b w/ qwen 3.5 9b ([5bd7444](https://github.com/togethercomputer/together-typescript/commit/5bd744484f4c626865c71e7046078077b2ea5c8f))
* Update training type for price estimation too ([52c3b77](https://github.com/togethercomputer/together-typescript/commit/52c3b77ff92751cbd788820ec20b195f040d9d16))


### Bug Fixes

* **client:** avoid removing abort listener too early ([1376258](https://github.com/togethercomputer/together-typescript/commit/137625849136205dc82f3b2493c96709365933ba))
* **client:** preserve URL params already embedded in path ([940974d](https://github.com/togethercomputer/together-typescript/commit/940974d0043587773a3e294c7744ace2008201d9))
* **docs/contributing:** correct pnpm link command ([eab2b6e](https://github.com/togethercomputer/together-typescript/commit/eab2b6e70c14fd53c4913fdaa0d2c51cc42a3e3b))
* fix request delays for retrying to be more respectful of high requested delays ([11669ff](https://github.com/togethercomputer/together-typescript/commit/11669ff27aa05901764cfb300dc33927da4002c7))
* fixed autoscaling configs in deployments api ([4dac51b](https://github.com/togethercomputer/together-typescript/commit/4dac51ba4914f36a26c93f418ffdfa8e12cbf678))
* **internal:** skip tests that depend on mock server ([be7e0e7](https://github.com/togethercomputer/together-typescript/commit/be7e0e717e129fcdca13570d5967d61d8107240f))
* **types:** change model to string in chat completions ([91a8c77](https://github.com/togethercomputer/together-typescript/commit/91a8c775d68930dd539bcce1b059274ae8f91863))


### Chores

* **ci:** skip uploading artifacts on stainless-internal branches ([603c86c](https://github.com/togethercomputer/together-typescript/commit/603c86c65a947e54c0998d5c10c1d4f6489f7f96))
* configure new SDK language ([b6f30b6](https://github.com/togethercomputer/together-typescript/commit/b6f30b6587c51483d7aace93a19350d4acb22061))
* Fix broken lint ([#213](https://github.com/togethercomputer/together-typescript/issues/213)) ([2463a75](https://github.com/togethercomputer/together-typescript/commit/2463a75429bc924bec67a7cf6eb0ef6a8b5fa87b))
* Fix various docstrings ([af4c47f](https://github.com/togethercomputer/together-typescript/commit/af4c47fab26f6ad7599866d2facd2075dfb7f7d7))
* **internal/client:** fix form-urlencoded requests ([d73f69f](https://github.com/togethercomputer/together-typescript/commit/d73f69fb0a280ad9d2c1f15da25d3695ff9c55c7))
* **internal:** avoid type checking errors with ts-reset ([70ad44b](https://github.com/togethercomputer/together-typescript/commit/70ad44b46220b19de3a0def616593e2382bda8dd))
* **internal:** move stringifyQuery implementation to internal function ([54dc83f](https://github.com/togethercomputer/together-typescript/commit/54dc83f02b0df002689776dd098bffbb06299934))
* **internal:** tweak CI branches ([e8d66c5](https://github.com/togethercomputer/together-typescript/commit/e8d66c54b571a1ca83473b00368c25e9d45a537e))
* **internal:** update dependencies to address dependabot vulnerabilities ([e442dfd](https://github.com/togethercomputer/together-typescript/commit/e442dfd169a1809ea915f60d38ec80b2e22e86b9))
* Remove broken field LineCount from FileResponse ([a0c187e](https://github.com/togethercomputer/together-typescript/commit/a0c187e9ae89232655f4e29e82ed08778fa70294))
* Revert adding mcp code. Code additions were unexpected. ([bb39360](https://github.com/togethercomputer/together-typescript/commit/bb39360b1f1815afa03cd59aec365c76f6fa6bf0))
* **test:** do not count install time for mock server timeout ([4f232bf](https://github.com/togethercomputer/together-typescript/commit/4f232bf81907963b78e8bd94b19dbcfa25929954))
* Update descriptions for jig queue methods and properties ([7fdfcca](https://github.com/togethercomputer/together-typescript/commit/7fdfcca72618b3ea51d38ac01f91e6a08ad0863e))
* update mock server docs ([ac14bf7](https://github.com/togethercomputer/together-typescript/commit/ac14bf741e8980c297b657f886d8ea0a88c15dcc))
* update placeholder string ([e481cda](https://github.com/togethercomputer/together-typescript/commit/e481cda9fffbd1ed5ec89a8f9e61258fefef2ac5))

## 0.37.0 (2026-02-04)

Full Changelog: [v0.36.1...v0.37.0](https://github.com/togethercomputer/together-typescript/compare/v0.36.1...v0.37.0)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ $ yarn link together-ai
# With pnpm
$ pnpm link --global
$ cd ../my-package
$ pnpm link -global together-ai
$ pnpm link --global together-ai
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```sh
$ npx prism mock path/to/your/openapi.yml
$ ./scripts/mock
```

```sh
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Types:
- <code><a href="./src/resources/chat/completions.ts">ChatCompletion</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionAssistantMessageParam</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionChunk</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionPrompt</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionFunctionMessageParam</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionMessage</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionMessageParam</a></code>
Expand Down Expand Up @@ -154,7 +155,6 @@ Methods:
Types:

- <code><a href="./src/resources/files.ts">FileList</a></code>
- <code><a href="./src/resources/files.ts">FileObject</a></code>
- <code><a href="./src/resources/files.ts">FilePurpose</a></code>
- <code><a href="./src/resources/files.ts">FileResponse</a></code>
- <code><a href="./src/resources/files.ts">FileType</a></code>
Expand Down
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "together-ai",
"version": "0.37.0",
"version": "0.38.0",
"description": "The official TypeScript library for the Together API",
"author": "Together <dev-feedback@TogetherAI.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -54,6 +54,17 @@
"bin": {
"together-ai": "bin/cli"
},
"overrides": {
"minimatch": "^9.0.5"
},
"pnpm": {
"overrides": {
"minimatch": "^9.0.5"
}
},
"resolutions": {
"minimatch": "^9.0.5"
},
"exports": {
".": {
"import": "./dist/index.mjs",
Expand Down
13 changes: 12 additions & 1 deletion scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
# Pre-install the package so the download doesn't eat into the startup timeout
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version

npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
# Wait for server to come online (max 30s)
echo -n "Waiting for server"
attempts=0
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
attempts=$((attempts + 1))
if [ "$attempts" -ge 300 ]; then
echo
echo "Timed out waiting for Prism server to start"
cat .prism.log
exit 1
fi
echo -n "."
sleep 0.1
done
Expand Down
53 changes: 20 additions & 33 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { APIResponseProps } from './internal/parse';
import { getPlatformHeaders } from './internal/detect-platform';
import * as Shims from './internal/shims';
import * as Opts from './internal/request-options';
import { stringifyQuery } from './internal/utils/query';
import { VERSION } from './version';
import * as Errors from './core/error';
import * as Uploads from './core/uploads';
Expand Down Expand Up @@ -56,15 +57,7 @@ import {
Evals,
EvaluationJob,
} from './resources/evals';
import {
FileDeleteResponse,
FileList,
FileObject,
FilePurpose,
FileResponse,
FileType,
Files,
} from './resources/files';
import { FileDeleteResponse, FileList, FilePurpose, FileResponse, FileType, Files } from './resources/files';
import {
FineTuning,
FineTuningCancelResponse,
Expand Down Expand Up @@ -297,21 +290,8 @@ export class Together {
/**
* Basic re-implementation of `qs.stringify` for primitive types.
*/
protected stringifyQuery(query: Record<string, unknown>): string {
return Object.entries(query)
.filter(([_, value]) => typeof value !== 'undefined')
.map(([key, value]) => {
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
}
if (value === null) {
return `${encodeURIComponent(key)}=`;
}
throw new Errors.TogetherError(
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
);
})
.join('&');
protected stringifyQuery(query: object | Record<string, unknown>): string {
return stringifyQuery(query);
}

private getUserAgent(): string {
Expand Down Expand Up @@ -343,12 +323,13 @@ export class Together {
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));

const defaultQuery = this.defaultQuery();
if (!isEmptyObj(defaultQuery)) {
query = { ...defaultQuery, ...query };
const pathQuery = Object.fromEntries(url.searchParams);
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
query = { ...pathQuery, ...defaultQuery, ...query };
}

if (typeof query === 'object' && query && !Array.isArray(query)) {
url.search = this.stringifyQuery(query as Record<string, unknown>);
url.search = this.stringifyQuery(query);
}

return url.toString();
Expand Down Expand Up @@ -532,7 +513,7 @@ export class Together {
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);

const errText = await response.text().catch((err: any) => castToError(err).message);
const errJSON = safeJSON(errText);
const errJSON = safeJSON(errText) as any;
const errMessage = errJSON ? undefined : errText;

loggerFor(this).debug(
Expand Down Expand Up @@ -599,7 +580,6 @@ export class Together {
return await this.fetch.call(undefined, url, fetchOptions);
} finally {
clearTimeout(timeout);
if (signal) signal.removeEventListener('abort', abort);
Comment thread
cursor[bot] marked this conversation as resolved.
}
}

Expand Down Expand Up @@ -655,9 +635,9 @@ export class Together {
}
}

// If the API asks us to wait a certain amount of time (and it's a reasonable amount),
// just do what it says, but otherwise calculate a default
if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
// If the API asks us to wait a certain amount of time, just do what it
// says, but otherwise calculate a default
if (timeoutMillis === undefined) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retry delay accepts NaN and negative timeout values

Medium Severity

The retry timeout guard was changed from if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) to if (timeoutMillis === undefined). The old condition also caught NaN, negative, and zero values, falling back to the default exponential backoff. The new condition only catches undefined, so if Date.parse(retryAfterHeader) - Date.now() produces NaN (invalid date) or a negative number (past date), sleep receives that value, bypassing backoff and causing immediate rapid retries.

Fix in Cursor Fix in Web

const maxRetries = options.maxRetries ?? this.maxRetries;
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
}
Expand Down Expand Up @@ -783,6 +763,14 @@ export class Together {
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
) {
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
} else if (
typeof body === 'object' &&
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
) {
return {
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
body: this.stringifyQuery(body),
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Form encoding depends on exact content-type

Low Severity

buildBody() only switches to form-urlencoding when headers.values.get('content-type') equals exactly application/x-www-form-urlencoded. If callers set a valid variant like application/x-www-form-urlencoded; charset=utf-8, the body falls through to #encoder, likely producing a different encoding than the header implies.

Fix in Cursor Fix in Web

} else {
return this.#encoder({ body, headers });
}
Expand Down Expand Up @@ -868,7 +856,6 @@ export declare namespace Together {
export {
Files as Files,
type FileList as FileList,
type FileObject as FileObject,
type FilePurpose as FilePurpose,
type FileResponse as FileResponse,
type FileType as FileType,
Expand Down
4 changes: 2 additions & 2 deletions src/core/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
let data;

try {
data = JSON.parse(sse.data);
data = JSON.parse(sse.data) as any;
} catch (e) {
logger.error(`Could not parse message into JSON:`, sse.data);
logger.error(`From chunk:`, sse.raw);
Expand Down Expand Up @@ -121,7 +121,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
try {
for await (const line of iterLines()) {
if (done) continue;
if (line) yield JSON.parse(line);
if (line) yield JSON.parse(line) as Item;
}
done = true;
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/internal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './utils/env';
export * from './utils/log';
export * from './utils/uuid';
export * from './utils/sleep';
export * from './utils/query';
23 changes: 23 additions & 0 deletions src/internal/utils/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { TogetherError } from '../../core/error';

/**
* Basic re-implementation of `qs.stringify` for primitive types.
*/
export function stringifyQuery(query: object | Record<string, unknown>) {
return Object.entries(query)
.filter(([_, value]) => typeof value !== 'undefined')
.map(([key, value]) => {
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
}
if (value === null) {
return `${encodeURIComponent(key)}=`;
}
throw new TogetherError(
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
);
})
.join('&');
}
1 change: 1 addition & 0 deletions src/lib/AbstractChatCompletionRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ export abstract class AbstractChatCompletionRunner<
{
...restParams,
function_call,
// @ts-ignore
functions,
// @ts-ignore
messages: [...this.messages],
Expand Down
1 change: 1 addition & 0 deletions src/lib/ChatCompletionStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export class ChatCompletionStream
function finalizeChatCompletion(snapshot: ChatCompletionSnapshot): ChatCompletion {
const { id, choices, created, model, system_fingerprint, ...rest } = snapshot;
return {
prompt: [],
...rest,
id,
choices: choices.map(
Expand Down
3 changes: 3 additions & 0 deletions src/resources/audio/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export interface AudioSpeechStreamChunk {

model: string;

/**
* The object type, which is always `audio.tts.chunk`.
*/
object: 'audio.tts.chunk';
}

Expand Down
Loading
Loading