Skip to content

release: 0.17.0 #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
29c08f6
docs(readme): fix typo
stainless-app[bot] Apr 30, 2025
328ac07
chore(ci): bump node version for release workflows
stainless-app[bot] May 6, 2025
e3bdd28
docs: add examples to tsdocs
stainless-app[bot] May 6, 2025
a9c3c25
codegen metadata
stainless-app[bot] May 12, 2025
51be0d0
codegen metadata
stainless-app[bot] May 13, 2025
418cdbf
feat(api): api update
stainless-app[bot] May 13, 2025
5c9c32a
codegen metadata
stainless-app[bot] May 14, 2025
dac80cc
feat(api): api update
stainless-app[bot] May 14, 2025
a149f12
feat(api): api update
stainless-app[bot] Jun 4, 2025
ac5a26e
feat(api): Update spec and config to get all tests except code-interp…
stainless-app[bot] Jun 4, 2025
45cf024
codegen metadata
stainless-app[bot] May 19, 2025
d7b7e65
feat(api): api update
stainless-app[bot] May 19, 2025
aaa785d
codegen metadata
stainless-app[bot] May 20, 2025
426d647
feat(api): get test_code_interpreter passing
stainless-app[bot] May 21, 2025
d7d7c68
feat(api): api update
stainless-app[bot] May 21, 2025
fcc89b0
chore(docs): grammar improvements
stainless-app[bot] May 21, 2025
8de2307
feat(api): api update
stainless-app[bot] May 21, 2025
ba11056
feat(api): Formatting fixes, some lint fixes
stainless-app[bot] May 21, 2025
7419813
codegen metadata
stainless-app[bot] May 21, 2025
ac1b626
codegen metadata
stainless-app[bot] May 21, 2025
ad49d5a
codegen metadata
stainless-app[bot] May 21, 2025
c48b452
feat(api): Add file_type and file_purpose
stainless-app[bot] May 24, 2025
6efef6c
chore: improve publish-npm script --latest tag logic
stainless-app[bot] May 27, 2025
f06baab
feat(api): api update
stainless-app[bot] Jun 3, 2025
c365c86
feat(api): add files/upload apu support and switch upload_file method…
stainless-app[bot] Jun 4, 2025
24e6833
chore(docs): use top-level-await in example snippets
stainless-app[bot] Jun 3, 2025
5d0865a
feat(api): api update
stainless-app[bot] Jun 4, 2025
c7c3a91
feat(api): update spec / config to remove remaining codegen warnings
stainless-app[bot] Jun 4, 2025
26a5b65
fix(tests): remove unused tests
dtmeadows Jun 4, 2025
0ad22a6
fix(tests): format
dtmeadows Jun 4, 2025
9ab1b66
feat(api): address diagnostic issues in audio api, correct openapi is…
stainless-app[bot] Jun 10, 2025
ba1fa6c
codegen metadata
stainless-app[bot] Jun 10, 2025
91ffaf3
codegen metadata
stainless-app[bot] Jun 11, 2025
75375d0
codegen metadata
stainless-app[bot] Jun 11, 2025
471c909
fix: publish script — handle NPM errors correctly
stainless-app[bot] Jun 13, 2025
d64b679
chore(internal): make base APIResource abstract
stainless-app[bot] Jun 13, 2025
41c0132
release: 0.17.0
stainless-app[bot] Jun 13, 2025
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Bootstrap
run: ./scripts/bootstrap
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'

- name: Install dependencies
run: |
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.16.0"
".": "0.17.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 28
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-c949fc43297a5155ea4c433179ee6f0822e25a351f180a5539871687daead7ad.yml
openapi_spec_hash: ca24d10b37e987becfd16b30ea342459
config_hash: a60b100624e80dc8d9144e7bc306f5ce
configured_endpoints: 30
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-29df763b2f7896b4f214e444a58d7aba39a45f90380e5deb3e010ff964f6d14c.yml
openapi_spec_hash: 8706285e2ec0c0b777452a74ae015326
config_hash: d15dd709dd3f87b0a8b83b00b4abc881
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# Changelog

## 0.17.0 (2025-06-13)

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

### Features

* **api:** Add file_type and file_purpose ([c48b452](https://github.com/togethercomputer/together-typescript/commit/c48b452006a360c32dc4c270740b3e7c8e5ea5b8))
* **api:** add files/upload apu support and switch upload_file method over to use it. ([c365c86](https://github.com/togethercomputer/together-typescript/commit/c365c86033d20ef677e95707ccd4b3fe43c679a2))
* **api:** address diagnostic issues in audio api, correct openapi issue in images api, disambiguate a response in finetune api, enable automated testing on finetune and images ([9ab1b66](https://github.com/togethercomputer/together-typescript/commit/9ab1b661c4d830b982e1e2a5a184564c9c16e815))
* **api:** api update ([5d0865a](https://github.com/togethercomputer/together-typescript/commit/5d0865add14b040531018e85e59a38ee805a5a41))
* **api:** api update ([f06baab](https://github.com/togethercomputer/together-typescript/commit/f06baab288f7f54d73ad803550b9f3ce55ab6756))
* **api:** api update ([8de2307](https://github.com/togethercomputer/together-typescript/commit/8de23078f5b12ace4df74173a0e5fa0c86528d2d))
* **api:** api update ([d7d7c68](https://github.com/togethercomputer/together-typescript/commit/d7d7c686ca1a2c665d58323bbc5498671c4ee5ef))
* **api:** api update ([d7b7e65](https://github.com/togethercomputer/together-typescript/commit/d7b7e65ffab825567353d021f8ea1715a0e3b578))
* **api:** api update ([a149f12](https://github.com/togethercomputer/together-typescript/commit/a149f12a4ed7d852aef5448c827d86bbebe2ebf4))
* **api:** api update ([dac80cc](https://github.com/togethercomputer/together-typescript/commit/dac80cc60458d89fced596b22a3700be3d7a6c04))
* **api:** api update ([418cdbf](https://github.com/togethercomputer/together-typescript/commit/418cdbf1c267c33e2f01e4b3d48aa21c6a618268))
* **api:** Formatting fixes, some lint fixes ([ba11056](https://github.com/togethercomputer/together-typescript/commit/ba11056c22c6ce4ab829356d35a4c31540a2d5e1))
* **api:** get test_code_interpreter passing ([426d647](https://github.com/togethercomputer/together-typescript/commit/426d647fa45c2220f7293f26c1b79336c0e948df))
* **api:** update spec / config to remove remaining codegen warnings ([c7c3a91](https://github.com/togethercomputer/together-typescript/commit/c7c3a914e2b0bb866b01ba48a04add83bbb387cd))
* **api:** Update spec and config to get all tests except code-interpolation an fine_tune unit tests working. ([ac5a26e](https://github.com/togethercomputer/together-typescript/commit/ac5a26e7a65e66e3e7cdb3e83dbe75016c1f785f))


### Bug Fixes

* publish script — handle NPM errors correctly ([471c909](https://github.com/togethercomputer/together-typescript/commit/471c909ff1918076168d6dd221561c94a24bd947))
* **tests:** format ([0ad22a6](https://github.com/togethercomputer/together-typescript/commit/0ad22a67f73dce1d4d596c353a31be5abbd1e092))
* **tests:** remove unused tests ([26a5b65](https://github.com/togethercomputer/together-typescript/commit/26a5b65b48b4a20ac75cdc92b27c55e26b686382))


### Chores

* **ci:** bump node version for release workflows ([328ac07](https://github.com/togethercomputer/together-typescript/commit/328ac079658f878a74a28c3683e340bed6f15876))
* **docs:** grammar improvements ([fcc89b0](https://github.com/togethercomputer/together-typescript/commit/fcc89b0d13f7907fdb33ab23398ebae0003ec96e))
* **docs:** use top-level-await in example snippets ([24e6833](https://github.com/togethercomputer/together-typescript/commit/24e68333612469dcd5ec1bbd30993cb1d46ed61d))
* improve publish-npm script --latest tag logic ([6efef6c](https://github.com/togethercomputer/together-typescript/commit/6efef6c02fb2160f1b1a0ac33d128e4b45bf7ef3))
* **internal:** make base APIResource abstract ([d64b679](https://github.com/togethercomputer/together-typescript/commit/d64b6790659e223a1e003396d39dcd95fe35ef0e))


### Documentation

* add examples to tsdocs ([e3bdd28](https://github.com/togethercomputer/together-typescript/commit/e3bdd286bdca4d56cae2b106f15283f594b05200))
* **readme:** fix typo ([29c08f6](https://github.com/togethercomputer/together-typescript/commit/29c08f6c4126aa2a576aea5cbc0d16b033a9a04e))

## 0.16.0 (2025-04-28)

Full Changelog: [v0.15.2...v0.16.0](https://github.com/togethercomputer/together-typescript/compare/v0.15.2...v0.16.0)
Expand Down
112 changes: 75 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ const client = new Together({
apiKey: process.env['TOGETHER_API_KEY'], // This is the default and can be omitted
});

async function main() {
const chatCompletion = await client.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test!' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
});

console.log(chatCompletion.choices);
}
const chatCompletion = await client.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test!' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
});

main();
console.log(chatCompletion.choices);
```

## Streaming responses
Expand Down Expand Up @@ -72,19 +68,65 @@ const client = new Together({
apiKey: process.env['TOGETHER_API_KEY'], // This is the default and can be omitted
});

async function main() {
const params: Together.Chat.CompletionCreateParams = {
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
};
const chatCompletion: Together.Chat.ChatCompletion = await client.chat.completions.create(params);
}

main();
const params: Together.Chat.CompletionCreateParams = {
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
};
const chatCompletion: Together.Chat.ChatCompletion = await client.chat.completions.create(params);
```

Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.

## File uploads

Request parameters that correspond to file uploads can be passed in many different forms:

- `File` (or an object with the same structure)
- a `fetch` `Response` (or an object with the same structure)
- an `fs.ReadStream`
- the return value of our `toFile` helper

```ts
import fs from 'fs';
import fetch from 'node-fetch';
import Together, { toFile } from 'together-ai';

const client = new Together();

// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
await client.files.upload({
file: fs.createReadStream('/path/to/file'),
file_name: 'dataset.csv',
purpose: 'fine-tune',
});

// Or if you have the web `File` API you can pass a `File` instance:
await client.files.upload({
file: new File(['my bytes'], 'file'),
file_name: 'dataset.csv',
purpose: 'fine-tune',
});

// You can also pass a `fetch` `Response`:
await client.files.upload({
file: await fetch('https://somesite/file'),
file_name: 'dataset.csv',
purpose: 'fine-tune',
});

// Finally, if none of the above are convenient, you can use our `toFile` helper:
await client.files.upload({
file: await toFile(Buffer.from('my bytes'), 'file'),
file_name: 'dataset.csv',
purpose: 'fine-tune',
});
await client.files.upload({
file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
file_name: 'dataset.csv',
purpose: 'fine-tune',
});
```

## Handling errors

When the library is unable to connect to the API,
Expand All @@ -93,27 +135,23 @@ a subclass of `APIError` will be thrown:

<!-- prettier-ignore -->
```ts
async function main() {
const chatCompletion = await client.chat.completions
.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
})
.catch(async (err) => {
if (err instanceof Together.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
}

main();
const chatCompletion = await client.chat.completions
.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
})
.catch(async (err) => {
if (err instanceof Together.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
```

Error codes are as followed:
Error codes are as follows:

| Status Code | Error Type |
| ----------- | -------------------------- |
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Together please follow the respective company's security reporting guidelines.
or products provided by Together, please follow the respective company's security reporting guidelines.

### Together Terms and Policies

Please contact dev-feedback@TogetherAI.com for any questions or concerns regarding security of our services.
Please contact dev-feedback@TogetherAI.com for any questions or concerns regarding the security of our services.

---

Expand Down
28 changes: 25 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Types:
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionToolMessageParam</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionStructuredMessageImageURL</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionStructuredMessageText</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionStructuredMessageVideoURL</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionUsage</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionUserMessageParam</a></code>

Expand All @@ -37,6 +38,7 @@ Methods:
Types:

- <code><a href="./src/resources/completions.ts">Completion</a></code>
- <code><a href="./src/resources/completions.ts">CompletionChunk</a></code>
- <code><a href="./src/resources/completions.ts">LogProbs</a></code>
- <code><a href="./src/resources/completions.ts">ToolChoice</a></code>
- <code><a href="./src/resources/completions.ts">Tools</a></code>
Expand All @@ -60,34 +62,50 @@ Methods:
Types:

- <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">FileType</a></code>
- <code><a href="./src/resources/files.ts">FileRetrieveResponse</a></code>
- <code><a href="./src/resources/files.ts">FileListResponse</a></code>
- <code><a href="./src/resources/files.ts">FileDeleteResponse</a></code>
- <code><a href="./src/resources/files.ts">FileUploadResponse</a></code>

Methods:

- <code title="get /files/{id}">client.files.<a href="./src/resources/files.ts">retrieve</a>(id) -> FileRetrieveResponse</code>
- <code title="get /files">client.files.<a href="./src/resources/files.ts">list</a>() -> FileListResponse</code>
- <code title="delete /files/{id}">client.files.<a href="./src/resources/files.ts">delete</a>(id) -> FileDeleteResponse</code>
- <code title="get /files/{id}/content">client.files.<a href="./src/resources/files.ts">content</a>(id) -> Response</code>
- <code title="post /files/upload">client.files.<a href="./src/resources/files.ts">upload</a>({ ...params }) -> FileUploadResponse</code>

# FineTune

Types:

- <code><a href="./src/resources/fine-tune.ts">CosineLrSchedulerArgs</a></code>
- <code><a href="./src/resources/fine-tune.ts">FineTune</a></code>
- <code><a href="./src/resources/fine-tune.ts">FineTuneEvent</a></code>
- <code><a href="./src/resources/fine-tune.ts">FullTrainingType</a></code>
- <code><a href="./src/resources/fine-tune.ts">LinearLrSchedulerArgs</a></code>
- <code><a href="./src/resources/fine-tune.ts">LoRaTrainingType</a></code>
- <code><a href="./src/resources/fine-tune.ts">LrScheduler</a></code>
- <code><a href="./src/resources/fine-tune.ts">TrainingMethodDpo</a></code>
- <code><a href="./src/resources/fine-tune.ts">TrainingMethodSft</a></code>
- <code><a href="./src/resources/fine-tune.ts">FineTuneCreateResponse</a></code>
- <code><a href="./src/resources/fine-tune.ts">FineTuneListResponse</a></code>
- <code><a href="./src/resources/fine-tune.ts">FineTuneCancelResponse</a></code>
- <code><a href="./src/resources/fine-tune.ts">FineTuneDownloadResponse</a></code>
- <code><a href="./src/resources/fine-tune.ts">FineTuneListEventsResponse</a></code>
- <code><a href="./src/resources/fine-tune.ts">FineTuneRetrieveCheckpointsResponse</a></code>

Methods:

- <code title="post /fine-tunes">client.fineTune.<a href="./src/resources/fine-tune.ts">create</a>({ ...params }) -> FineTune</code>
- <code title="post /fine-tunes">client.fineTune.<a href="./src/resources/fine-tune.ts">create</a>({ ...params }) -> FineTuneCreateResponse</code>
- <code title="get /fine-tunes/{id}">client.fineTune.<a href="./src/resources/fine-tune.ts">retrieve</a>(id) -> FineTune</code>
- <code title="get /fine-tunes">client.fineTune.<a href="./src/resources/fine-tune.ts">list</a>() -> FineTuneListResponse</code>
- <code title="post /fine-tunes/{id}/cancel">client.fineTune.<a href="./src/resources/fine-tune.ts">cancel</a>(id) -> FineTune</code>
- <code title="post /fine-tunes/{id}/cancel">client.fineTune.<a href="./src/resources/fine-tune.ts">cancel</a>(id) -> FineTuneCancelResponse</code>
- <code title="get /finetune/download">client.fineTune.<a href="./src/resources/fine-tune.ts">download</a>({ ...params }) -> FineTuneDownloadResponse</code>
- <code title="get /fine-tunes/{id}/events">client.fineTune.<a href="./src/resources/fine-tune.ts">listEvents</a>(id) -> FineTuneEvent</code>
- <code title="get /fine-tunes/{id}/events">client.fineTune.<a href="./src/resources/fine-tune.ts">listEvents</a>(id) -> FineTuneListEventsResponse</code>
- <code title="get /fine-tunes/{id}/checkpoints">client.fineTune.<a href="./src/resources/fine-tune.ts">retrieveCheckpoints</a>(id) -> FineTuneRetrieveCheckpointsResponse</code>

# CodeInterpreter

Expand All @@ -113,6 +131,8 @@ Methods:

Types:

- <code><a href="./src/resources/images.ts">ImageDataB64</a></code>
- <code><a href="./src/resources/images.ts">ImageDataURL</a></code>
- <code><a href="./src/resources/images.ts">ImageFile</a></code>

Methods:
Expand All @@ -124,6 +144,7 @@ Methods:
Types:

- <code><a href="./src/resources/audio.ts">AudioFile</a></code>
- <code><a href="./src/resources/audio.ts">AudioSpeechStreamChunk</a></code>

Methods:

Expand Down Expand Up @@ -157,6 +178,7 @@ Methods:

Types:

- <code><a href="./src/resources/endpoints.ts">Autoscaling</a></code>
- <code><a href="./src/resources/endpoints.ts">EndpointCreateResponse</a></code>
- <code><a href="./src/resources/endpoints.ts">EndpointRetrieveResponse</a></code>
- <code><a href="./src/resources/endpoints.ts">EndpointUpdateResponse</a></code>
Expand Down
52 changes: 44 additions & 8 deletions bin/publish-npm
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,55 @@ set -eux

npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"

# Build the project
yarn build

# Navigate to the dist directory
cd dist

# Get the version from package.json
VERSION="$(node -p "require('./package.json').version")"
# Get package name and version from package.json
PACKAGE_NAME="$(jq -r -e '.name' ./package.json)"
VERSION="$(jq -r -e '.version' ./package.json)"

# Get latest version from npm
#
# If the package doesn't exist, npm will return:
# {
# "error": {
# "code": "E404",
# "summary": "Unpublished on 2025-06-05T09:54:53.528Z",
# "detail": "'the_package' is not in this registry..."
# }
# }
NPM_INFO="$(npm view "$PACKAGE_NAME" version --json 2>/dev/null || true)"

# Check if we got an E404 error
if echo "$NPM_INFO" | jq -e '.error.code == "E404"' > /dev/null 2>&1; then
# Package doesn't exist yet, no last version
LAST_VERSION=""
elif echo "$NPM_INFO" | jq -e '.error' > /dev/null 2>&1; then
# Report other errors
echo "ERROR: npm returned unexpected data:"
echo "$NPM_INFO"
exit 1
else
# Success - get the version
LAST_VERSION=$(echo "$NPM_INFO" | jq -r '.') # strip quotes
fi

# Extract the pre-release tag if it exists
# Check if current version is pre-release (e.g. alpha / beta / rc)
CURRENT_IS_PRERELEASE=false
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
# Extract the part before any dot in the pre-release identifier
TAG="${BASH_REMATCH[1]}"
CURRENT_IS_PRERELEASE=true
CURRENT_TAG="${BASH_REMATCH[1]}"
fi

# Check if last version is a stable release
LAST_IS_STABLE_RELEASE=true
if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then
LAST_IS_STABLE_RELEASE=false
fi

# Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease.
if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then
TAG="$CURRENT_TAG"
else
TAG="latest"
fi
Expand Down
Loading
Loading