Skip to content
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

release: 0.6.0-alpha.5 #29

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Empty file modified .devcontainer/Dockerfile
100644 → 100755
Empty file.
Empty file modified .devcontainer/devcontainer.json
100644 → 100755
Empty file.
Empty file modified .eslintrc.js
100644 → 100755
Empty file.
Empty file modified .github/workflows/ci.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/publish-npm.yml
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions .github/workflows/release-doctor.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Release Doctor
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
Expand All @@ -17,3 +19,4 @@ jobs:
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.TOGETHER_NPM_TOKEN || secrets.NPM_TOKEN }}

Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .prettierignore
100644 → 100755
Empty file.
Empty file modified .prettierrc.json
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.6.0-alpha.4"
".": "0.6.0-alpha.5"
}
2 changes: 1 addition & 1 deletion .stats.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2FTogetherAI-aa19594b663913393bdbc1b56903615e4eb84c6ebc60617ab2f451ede8a730c2.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2FTogetherAI-4d2d6b953f3918f01c022b00942571be9241e37a4e6877444e0353913f21cba0.yml
Empty file modified Brewfile
100644 → 100755
Empty file.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.6.0-alpha.5 (2024-08-20)

Full Changelog: [v0.6.0-alpha.4...v0.6.0-alpha.5](https://github.com/togethercomputer/together-typescript/compare/v0.6.0-alpha.4...v0.6.0-alpha.5)

### Features

* **api:** manual updates ([#31](https://github.com/togethercomputer/together-typescript/issues/31)) ([52c8005](https://github.com/togethercomputer/together-typescript/commit/52c800544043060963bf09ef10d3596d3855a86e))
* **api:** OpenAPI spec update via Stainless API ([#28](https://github.com/togethercomputer/together-typescript/issues/28)) ([9544a3f](https://github.com/togethercomputer/together-typescript/commit/9544a3f961b816fd59338db99b5f9b499dbfe832))
* **api:** OpenAPI spec update via Stainless API ([#36](https://github.com/togethercomputer/together-typescript/issues/36)) ([0154ccf](https://github.com/togethercomputer/together-typescript/commit/0154ccf0758b9ec9117b5a399eade3e51f49c5fd))
* **api:** OpenAPI spec update via Stainless API ([#39](https://github.com/togethercomputer/together-typescript/issues/39)) ([a141abb](https://github.com/togethercomputer/together-typescript/commit/a141abb2184e99a291eb5ea634fda71fca85f47b))


### Chores

* **ci:** bump prism mock server version ([#35](https://github.com/togethercomputer/together-typescript/issues/35)) ([2723c30](https://github.com/togethercomputer/together-typescript/commit/2723c30cd88f69fb77442faeb8a316bf1c5cde88))
* **ci:** minor changes ([#34](https://github.com/togethercomputer/together-typescript/issues/34)) ([54b4da5](https://github.com/togethercomputer/together-typescript/commit/54b4da54aeec098d154486f09ba52f6e8bc3f715))
* **examples:** minor formatting changes ([#38](https://github.com/togethercomputer/together-typescript/issues/38)) ([35f5465](https://github.com/togethercomputer/together-typescript/commit/35f546552c433af8d518db0b44f7fcd473c02eab))
* force eslint to use non flat config ([#33](https://github.com/togethercomputer/together-typescript/issues/33)) ([a327432](https://github.com/togethercomputer/together-typescript/commit/a327432973bc4f245ec272dcd58a7d0a4f117c09))
* **internal:** codegen related update ([#32](https://github.com/togethercomputer/together-typescript/issues/32)) ([edd1691](https://github.com/togethercomputer/together-typescript/commit/edd16911c877b06679f6f7759486e2ed442c94c5))
* **internal:** codegen related update ([#37](https://github.com/togethercomputer/together-typescript/issues/37)) ([12be697](https://github.com/togethercomputer/together-typescript/commit/12be697f897f91ce94edd5ec5fca6abe236a5135))

## 0.6.0-alpha.4 (2024-07-16)

Full Changelog: [v0.6.0-alpha.3...v0.6.0-alpha.4](https://github.com/togethercomputer/together-typescript/compare/v0.6.0-alpha.3...v0.6.0-alpha.4)
Expand Down
Empty file modified CONTRIBUTING.md
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
32 changes: 16 additions & 16 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ The full API of this library can be found in [api.md](api.md).
```js
import Together from 'together-ai';

const together = new Together({
const client = new Together({
apiKey: process.env['TOGETHER_API_KEY'], // This is the default and can be omitted
});

async function main() {
const chatCompletion = await together.chat.completions.create({
const chatCompletion = await client.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test!' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
});
Expand All @@ -45,9 +45,9 @@ We provide support for streaming responses using Server Sent Events (SSE).
```ts
import Together from 'together-ai';

const together = new Together();
const client = new Together();

const stream = await together.chat.completions.create({
const stream = await client.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
stream: true,
Expand All @@ -68,7 +68,7 @@ This library includes TypeScript definitions for all request params and response
```ts
import Together from 'together-ai';

const together = new Together({
const client = new Together({
apiKey: process.env['TOGETHER_API_KEY'], // This is the default and can be omitted
});

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

main();
Expand All @@ -94,7 +94,7 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const chatCompletion = await together.chat.completions
const chatCompletion = await client.chat.completions
.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
Expand Down Expand Up @@ -137,12 +137,12 @@ You can use the `maxRetries` option to configure or disable this:
<!-- prettier-ignore -->
```js
// Configure the default for all requests:
const together = new Together({
const client = new Together({
maxRetries: 0, // default is 2
});

// Or, configure per-request:
await together.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'mistralai/Mixtral-8x7B-Instruct-v0.1' }, {
await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'mistralai/Mixtral-8x7B-Instruct-v0.1' }, {
maxRetries: 5,
});
```
Expand All @@ -154,12 +154,12 @@ Requests time out after 1 minute by default. You can configure this with a `time
<!-- prettier-ignore -->
```ts
// Configure the default for all requests:
const together = new Together({
const client = new Together({
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
});

// Override per-request:
await together.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'mistralai/Mixtral-8x7B-Instruct-v0.1' }, {
await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'mistralai/Mixtral-8x7B-Instruct-v0.1' }, {
timeout: 5 * 1000,
});
```
Expand All @@ -178,9 +178,9 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi

<!-- prettier-ignore -->
```ts
const together = new Together();
const client = new Together();

const response = await together.chat.completions
const response = await client.chat.completions
.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
Expand All @@ -189,7 +189,7 @@ const response = await together.chat.completions
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: chatCompletion, response: raw } = await together.chat.completions
const { data: chatCompletion, response: raw } = await client.chat.completions
.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
Expand Down Expand Up @@ -295,12 +295,12 @@ import http from 'http';
import { HttpsProxyAgent } from 'https-proxy-agent';

// Configure the default for all requests:
const together = new Together({
const client = new Together({
httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
});

// Override per-request:
await together.chat.completions.create(
await client.chat.completions.create(
{
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
Expand Down
Empty file modified SECURITY.md
100644 → 100755
Empty file.
8 changes: 8 additions & 0 deletions api.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
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">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>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionSystemMessageParam</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionTool</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionToolMessageParam</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionUsage</a></code>
- <code><a href="./src/resources/chat/completions.ts">ChatCompletionUserMessageParam</a></code>

Methods:

Expand Down
14 changes: 2 additions & 12 deletions bin/check-release-environment
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
#!/usr/bin/env bash

warnings=()
errors=()

if [ -z "${NPM_TOKEN}" ]; then
warnings+=("The TOGETHER_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi

lenWarnings=${#warnings[@]}

if [[ lenWarnings -gt 0 ]]; then
echo -e "Found the following warnings in the release environment:\n"

for warning in "${warnings[@]}"; do
echo -e "- $warning\n"
done
errors+=("The TOGETHER_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi

lenErrors=${#errors[@]}
Expand All @@ -30,3 +19,4 @@ if [[ lenErrors -gt 0 ]]; then
fi

echo "The environment is ready to push releases!"

20 changes: 18 additions & 2 deletions bin/publish-npm
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,24 @@

set -eux

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

# Build the project
yarn build

# Navigate to the dist directory
cd dist
yarn publish --access public

# Get the version from package.json
VERSION="$(node -p "require('./package.json').version")"

# Extract the pre-release tag if it exists
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
# Extract the part before any dot in the pre-release identifier
TAG="${BASH_REMATCH[1]}"
else
TAG="latest"
fi

# Publish with the appropriate tag
yarn publish --access public --tag "$TAG"
Empty file modified examples/.keep
100644 → 100755
Empty file.
24 changes: 24 additions & 0 deletions examples/chat-completions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env -S npm run tsn -T

import Together from 'together-ai';

const together = new Together();
async function main() {
const runner = together.chat.completions
.stream({
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
messages: [{ role: 'user', content: 'Say this is a test' }],
})
.on('message', (msg) => console.log(msg))
.on('content', (diff) => process.stdout.write(diff));

for await (const chunk of runner) {
// Note: comment out the next line to print chunks as they are streamed from the API
// console.log('chunk', chunk);
}

const result = await runner.finalMessage();
console.log(result);
}

main();
2 changes: 1 addition & 1 deletion examples/embedding.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S npm run tsn -T

import Together from 'together';
import Together from 'together-ai';

const together = new Together();

Expand Down
2 changes: 1 addition & 1 deletion examples/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Example of listing and retrieving files

import Together from 'together';
import Together from 'together-ai';

const together = new Together();

Expand Down
2 changes: 1 addition & 1 deletion examples/fine-tune.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S npm run tsn -T

import Together from 'together';
import Together from 'together-ai';

const together = new Together();

Expand Down
2 changes: 1 addition & 1 deletion examples/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//An example to generate an image and save to a file

import Together from 'together';
import Together from 'together-ai';
import fs from 'fs';

const together = new Together();
Expand Down
2 changes: 1 addition & 1 deletion examples/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//An example to request a list of models and print them.

import Together from 'together';
import Together from 'together-ai';

const together = new Together();

Expand Down
2 changes: 1 addition & 1 deletion examples/streaming.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S npm run tsn -T

import Together from 'together';
import Together from 'together-ai';

const together = new Together();

Expand Down
Empty file modified jest.config.ts
100644 → 100755
Empty file.
7 changes: 3 additions & 4 deletions package.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "together-ai",
"version": "0.6.0-alpha.4",
"version": "0.6.0-alpha.5",
"description": "The official TypeScript library for the Together API",
"author": "Together <[email protected]>",
"types": "dist/index.d.ts",
Expand All @@ -21,7 +21,7 @@
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "./scripts/lint",
"fix": "eslint --fix --ext ts,js ."
"fix": "./scripts/format"
},
"dependencies": {
"@types/node": "^18.11.18",
Expand All @@ -30,8 +30,7 @@
"agentkeepalive": "^4.2.1",
"form-data-encoder": "1.7.2",
"formdata-node": "^4.3.2",
"node-fetch": "^2.6.7",
"web-streams-polyfill": "^3.2.1"
"node-fetch": "^2.6.7"
},
"devDependencies": {
"@swc/core": "^1.3.102",
Expand Down
Empty file modified release-please-config.json
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
cd "$(dirname "$0")/.."

echo "==> Running eslint --fix"
./node_modules/.bin/eslint --fix --ext ts,js .
ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js .
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
cd "$(dirname "$0")/.."

echo "==> Running eslint"
./node_modules/.bin/eslint --ext ts,js .
ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js .
4 changes: 2 additions & 2 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stainless-api/[email protected].5 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
echo -n "Waiting for server"
Expand All @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then

echo
else
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL"
npm exec --package=@stainless-api/[email protected].5 -- prism mock "$URL"
fi
Empty file modified scripts/utils/check-version.cjs
100644 → 100755
Empty file.
Empty file modified scripts/utils/fix-index-exports.cjs
100644 → 100755
Empty file.
Empty file modified scripts/utils/make-dist-package-json.cjs
100644 → 100755
Empty file.
Empty file modified scripts/utils/postprocess-files.cjs
100644 → 100755
Empty file.
Empty file modified src/_shims/MultipartBody.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/README.md
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/runtime-bun.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/runtime-deno.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/runtime-node.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/runtime.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/types-deno.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/types-node.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/types.d.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/types.js
100644 → 100755
Empty file.
Empty file modified src/_shims/auto/types.mjs
100644 → 100755
Empty file.
Empty file modified src/_shims/bun-runtime.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/index-deno.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/index.d.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/index.js
100644 → 100755
Empty file.
Empty file modified src/_shims/index.mjs
100644 → 100755
Empty file.
Empty file modified src/_shims/manual-types.d.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/manual-types.js
100644 → 100755
Empty file.
Empty file modified src/_shims/manual-types.mjs
100644 → 100755
Empty file.
4 changes: 1 addition & 3 deletions src/_shims/node-runtime.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import { Readable } from 'node:stream';
import { type RequestOptions } from '../core';
import { MultipartBody } from './MultipartBody';
import { type Shims } from './registry';

// @ts-ignore (this package does not have proper export maps for this export)
import { ReadableStream } from 'web-streams-polyfill/dist/ponyfill.es2018.js';
import { ReadableStream } from 'node:stream/web';

type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;

Expand Down
Empty file modified src/_shims/node-types.d.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/node-types.js
100644 → 100755
Empty file.
Empty file modified src/_shims/node-types.mjs
100644 → 100755
Empty file.
Empty file modified src/_shims/registry.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/web-runtime.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/web-types.d.ts
100644 → 100755
Empty file.
Empty file modified src/_shims/web-types.js
100644 → 100755
Empty file.
Empty file modified src/_shims/web-types.mjs
100644 → 100755
Empty file.
Empty file modified src/core.ts
100644 → 100755
Empty file.
Empty file modified src/error.ts
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions src/index.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class Together extends Core.APIClient {
}

static Together = this;
static DEFAULT_TIMEOUT = 60000; // 1 minute

static TogetherError = Errors.TogetherError;
static APIError = Errors.APIError;
Expand Down
Empty file modified src/lib/.keep
100644 → 100755
Empty file.
Loading