together-ai
Advanced tools
Comparing version 0.6.0-alpha.4 to 0.6.0-alpha.7
@@ -41,4 +41,3 @@ "use strict"; | ||
const MultipartBody_1 = require("./MultipartBody.js"); | ||
// @ts-ignore (this package does not have proper export maps for this export) | ||
const ponyfill_es2018_js_1 = require("web-streams-polyfill/dist/ponyfill.es2018.js"); | ||
const web_1 = require("node:stream/web"); | ||
let fileFromPathWarned = false; | ||
@@ -83,3 +82,3 @@ async function fileFromPath(path, ...args) { | ||
File: fd.File, | ||
ReadableStream: ponyfill_es2018_js_1.ReadableStream, | ||
ReadableStream: web_1.ReadableStream, | ||
getMultipartRequestOptions, | ||
@@ -86,0 +85,0 @@ getDefaultAgent: (url) => (url.startsWith('https') ? defaultHttpsAgent : defaultHttpAgent), |
# Changelog | ||
## 0.6.0-alpha.7 (2024-08-28) | ||
Full Changelog: [v0.6.0-alpha.6...v0.6.0-alpha.7](https://github.com/togethercomputer/together-typescript/compare/v0.6.0-alpha.6...v0.6.0-alpha.7) | ||
### Features | ||
* **api:** OpenAPI spec update via Stainless API ([#44](https://github.com/togethercomputer/together-typescript/issues/44)) ([5fbcdd8](https://github.com/togethercomputer/together-typescript/commit/5fbcdd8eb359ccd8f0bceb34d8d424c96e3e4268)) | ||
### Bug Fixes | ||
* chat completion streaming when enabling logprobs ([cad72ef](https://github.com/togethercomputer/together-typescript/commit/cad72ef78213cbaa4497c7358b65e94c4b15f99a)) | ||
### Chores | ||
* **ci:** check for build errors ([#46](https://github.com/togethercomputer/together-typescript/issues/46)) ([ef2541c](https://github.com/togethercomputer/together-typescript/commit/ef2541c70dfee841373dfe16a5c866ebcf382822)) | ||
## 0.6.0-alpha.6 (2024-08-26) | ||
Full Changelog: [v0.6.0-alpha.5...v0.6.0-alpha.6](https://github.com/togethercomputer/together-typescript/compare/v0.6.0-alpha.5...v0.6.0-alpha.6) | ||
### Chores | ||
* **internal:** codegen related update ([#41](https://github.com/togethercomputer/together-typescript/issues/41)) ([3776c8d](https://github.com/togethercomputer/together-typescript/commit/3776c8d661824afa6dc33a1af725eb105e38fff3)) | ||
## 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) | ||
@@ -4,0 +51,0 @@ |
@@ -91,2 +91,3 @@ import * as Errors from "./error.js"; | ||
static Together: typeof Together; | ||
static DEFAULT_TIMEOUT: number; | ||
static TogetherError: typeof Errors.TogetherError; | ||
@@ -93,0 +94,0 @@ static APIError: typeof Errors.APIError; |
@@ -91,2 +91,3 @@ "use strict"; | ||
Together.Together = _a; | ||
Together.DEFAULT_TIMEOUT = 60000; // 1 minute | ||
Together.TogetherError = Errors.TogetherError; | ||
@@ -93,0 +94,0 @@ Together.APIError = Errors.APIError; |
{ | ||
"name": "together-ai", | ||
"version": "0.6.0-alpha.4", | ||
"version": "0.6.0-alpha.7", | ||
"description": "The official TypeScript library for the Together API", | ||
@@ -22,3 +22,3 @@ "author": "Together <dev-feedback@TogetherAI.com>", | ||
"lint": "./scripts/lint", | ||
"fix": "eslint --fix --ext ts,js ." | ||
"fix": "./scripts/format" | ||
}, | ||
@@ -32,4 +32,3 @@ "dependencies": { | ||
"formdata-node": "^4.3.2", | ||
"node-fetch": "^2.6.7", | ||
"web-streams-polyfill": "^3.2.1" | ||
"node-fetch": "^2.6.7" | ||
}, | ||
@@ -36,0 +35,0 @@ "sideEffects": [ |
@@ -25,3 +25,3 @@ # Together Node API Library | ||
const together = new Together({ | ||
const client = new Together({ | ||
apiKey: process.env['TOGETHER_API_KEY'], // This is the default and can be omitted | ||
@@ -31,3 +31,3 @@ }); | ||
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!' }], | ||
@@ -50,5 +50,5 @@ model: 'mistralai/Mixtral-8x7B-Instruct-v0.1', | ||
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' }], | ||
@@ -74,3 +74,3 @@ model: 'mistralai/Mixtral-8x7B-Instruct-v0.1', | ||
const together = new Together({ | ||
const client = new Together({ | ||
apiKey: process.env['TOGETHER_API_KEY'], // This is the default and can be omitted | ||
@@ -84,3 +84,3 @@ }); | ||
}; | ||
const chatCompletion: Together.Chat.ChatCompletion = await together.chat.completions.create(params); | ||
const chatCompletion: Together.Chat.ChatCompletion = await client.chat.completions.create(params); | ||
} | ||
@@ -102,3 +102,3 @@ | ||
async function main() { | ||
const chatCompletion = await together.chat.completions | ||
const chatCompletion = await client.chat.completions | ||
.create({ | ||
@@ -146,3 +146,3 @@ messages: [{ role: 'user', content: 'Say this is a test' }], | ||
// Configure the default for all requests: | ||
const together = new Together({ | ||
const client = new Together({ | ||
maxRetries: 0, // default is 2 | ||
@@ -152,3 +152,3 @@ }); | ||
// 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, | ||
@@ -165,3 +165,3 @@ }); | ||
// Configure the default for all requests: | ||
const together = new Together({ | ||
const client = new Together({ | ||
timeout: 20 * 1000, // 20 seconds (default is 1 minute) | ||
@@ -171,3 +171,3 @@ }); | ||
// 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, | ||
@@ -191,5 +191,5 @@ }); | ||
```ts | ||
const together = new Together(); | ||
const client = new Together(); | ||
const response = await together.chat.completions | ||
const response = await client.chat.completions | ||
.create({ | ||
@@ -203,3 +203,3 @@ messages: [{ role: 'user', content: 'Say this is a test' }], | ||
const { data: chatCompletion, response: raw } = await together.chat.completions | ||
const { data: chatCompletion, response: raw } = await client.chat.completions | ||
.create({ | ||
@@ -310,3 +310,3 @@ messages: [{ role: 'user', content: 'Say this is a test' }], | ||
// Configure the default for all requests: | ||
const together = new Together({ | ||
const client = new Together({ | ||
httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), | ||
@@ -316,3 +316,3 @@ }); | ||
// Override per-request: | ||
await together.chat.completions.create( | ||
await client.chat.completions.create( | ||
{ | ||
@@ -319,0 +319,0 @@ messages: [{ role: 'user', content: 'Say this is a test' }], |
@@ -9,4 +9,12 @@ import { APIResource } from "../../resource.js"; | ||
export import ChatCompletion = CompletionsAPI.ChatCompletion; | ||
export import ChatCompletionAssistantMessageParam = CompletionsAPI.ChatCompletionAssistantMessageParam; | ||
export import ChatCompletionChunk = CompletionsAPI.ChatCompletionChunk; | ||
export import ChatCompletionFunctionMessageParam = CompletionsAPI.ChatCompletionFunctionMessageParam; | ||
export import ChatCompletionMessage = CompletionsAPI.ChatCompletionMessage; | ||
export import ChatCompletionMessageParam = CompletionsAPI.ChatCompletionMessageParam; | ||
export import ChatCompletionSystemMessageParam = CompletionsAPI.ChatCompletionSystemMessageParam; | ||
export import ChatCompletionTool = CompletionsAPI.ChatCompletionTool; | ||
export import ChatCompletionToolMessageParam = CompletionsAPI.ChatCompletionToolMessageParam; | ||
export import ChatCompletionUsage = CompletionsAPI.ChatCompletionUsage; | ||
export import ChatCompletionUserMessageParam = CompletionsAPI.ChatCompletionUserMessageParam; | ||
export import CompletionCreateParams = CompletionsAPI.CompletionCreateParams; | ||
@@ -13,0 +21,0 @@ export import CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming; |
@@ -7,2 +7,3 @@ import { APIResource } from "../../resource.js"; | ||
import { Stream } from "../../streaming.js"; | ||
import { ChatCompletionStream, ChatCompletionStreamParams } from 'together-ai/lib/ChatCompletionStream'; | ||
export declare class Completions extends APIResource { | ||
@@ -15,2 +16,3 @@ /** | ||
create(body: CompletionCreateParamsBase, options?: Core.RequestOptions): APIPromise<Stream<ChatCompletionChunk> | ChatCompletion>; | ||
stream(body: ChatCompletionStreamParams, options?: Core.RequestOptions): ChatCompletionStream; | ||
} | ||
@@ -30,25 +32,24 @@ export interface ChatCompletion { | ||
logprobs?: CompletionsAPI.LogProbs | null; | ||
message?: Choice.Message; | ||
message?: ChatCompletionsAPI.ChatCompletionMessage; | ||
seed?: number; | ||
text?: string; | ||
} | ||
namespace Choice { | ||
interface Message { | ||
content: string | null; | ||
role: 'assistant'; | ||
/** | ||
* @deprecated | ||
*/ | ||
function_call?: Message.FunctionCall; | ||
tool_calls?: Array<CompletionsAPI.ToolChoice>; | ||
} | ||
namespace Message { | ||
/** | ||
* @deprecated | ||
*/ | ||
interface FunctionCall { | ||
arguments: string; | ||
name: string; | ||
} | ||
} | ||
} | ||
export interface ChatCompletionAssistantMessageParam { | ||
role: 'assistant'; | ||
content?: string | null; | ||
/** | ||
* @deprecated | ||
*/ | ||
function_call?: ChatCompletionAssistantMessageParam.FunctionCall; | ||
name?: string; | ||
tool_calls?: Array<CompletionsAPI.ToolChoice>; | ||
} | ||
export declare namespace ChatCompletionAssistantMessageParam { | ||
/** | ||
* @deprecated | ||
*/ | ||
interface FunctionCall { | ||
arguments: string; | ||
name: string; | ||
} | ||
@@ -68,8 +69,9 @@ } | ||
delta: Choice.Delta; | ||
finish_reason: 'stop' | 'eos' | 'length' | 'tool_calls' | 'function_call'; | ||
finish_reason: 'stop' | 'eos' | 'length' | 'tool_calls' | 'function_call' | null; | ||
index: number; | ||
logprobs?: CompletionsAPI.LogProbs; | ||
logprobs?: number | null; | ||
} | ||
namespace Choice { | ||
interface Delta { | ||
role: 'system' | 'user' | 'assistant' | 'function' | 'tool'; | ||
content?: string | null; | ||
@@ -80,3 +82,2 @@ /** | ||
function_call?: Delta.FunctionCall | null; | ||
role?: 'system' | 'user' | 'assistant' | 'function' | 'tool'; | ||
token_id?: number; | ||
@@ -96,2 +97,51 @@ tool_calls?: Array<CompletionsAPI.ToolChoice>; | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export interface ChatCompletionFunctionMessageParam { | ||
content: string; | ||
name: string; | ||
role: 'function'; | ||
} | ||
export interface ChatCompletionMessage { | ||
content: string | null; | ||
role: 'assistant'; | ||
/** | ||
* @deprecated | ||
*/ | ||
function_call?: ChatCompletionMessage.FunctionCall; | ||
tool_calls?: Array<CompletionsAPI.ToolChoice>; | ||
} | ||
export declare namespace ChatCompletionMessage { | ||
/** | ||
* @deprecated | ||
*/ | ||
interface FunctionCall { | ||
arguments: string; | ||
name: string; | ||
} | ||
} | ||
export type ChatCompletionMessageParam = ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam | ChatCompletionToolMessageParam | ChatCompletionFunctionMessageParam; | ||
export interface ChatCompletionSystemMessageParam { | ||
content: string; | ||
role: 'system'; | ||
name?: string; | ||
} | ||
export interface ChatCompletionTool { | ||
function: ChatCompletionTool.Function; | ||
type: 'function'; | ||
} | ||
export declare namespace ChatCompletionTool { | ||
interface Function { | ||
name: string; | ||
description?: string; | ||
parameters?: Record<string, unknown>; | ||
} | ||
} | ||
export interface ChatCompletionToolMessageParam { | ||
content?: string; | ||
required?: unknown; | ||
role?: 'tool'; | ||
tool_call_id?: string; | ||
} | ||
export interface ChatCompletionUsage { | ||
@@ -102,2 +152,7 @@ completion_tokens: number; | ||
} | ||
export interface ChatCompletionUserMessageParam { | ||
content: string; | ||
role: 'user'; | ||
name?: string; | ||
} | ||
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming; | ||
@@ -138,3 +193,3 @@ export interface CompletionCreateParamsBase { | ||
/** | ||
* A number between 0 and 1 that can be used as an alternative to temperature. | ||
* A number between 0 and 1 that can be used as an alternative to top_p and top-k. | ||
*/ | ||
@@ -222,3 +277,3 @@ min_p?: number; | ||
*/ | ||
role: 'system' | 'user' | 'assistant'; | ||
role: 'system' | 'user' | 'assistant' | 'tool'; | ||
} | ||
@@ -262,4 +317,12 @@ interface Name { | ||
export import ChatCompletion = ChatCompletionsAPI.ChatCompletion; | ||
export import ChatCompletionAssistantMessageParam = ChatCompletionsAPI.ChatCompletionAssistantMessageParam; | ||
export import ChatCompletionChunk = ChatCompletionsAPI.ChatCompletionChunk; | ||
export import ChatCompletionFunctionMessageParam = ChatCompletionsAPI.ChatCompletionFunctionMessageParam; | ||
export import ChatCompletionMessage = ChatCompletionsAPI.ChatCompletionMessage; | ||
export import ChatCompletionMessageParam = ChatCompletionsAPI.ChatCompletionMessageParam; | ||
export import ChatCompletionSystemMessageParam = ChatCompletionsAPI.ChatCompletionSystemMessageParam; | ||
export import ChatCompletionTool = ChatCompletionsAPI.ChatCompletionTool; | ||
export import ChatCompletionToolMessageParam = ChatCompletionsAPI.ChatCompletionToolMessageParam; | ||
export import ChatCompletionUsage = ChatCompletionsAPI.ChatCompletionUsage; | ||
export import ChatCompletionUserMessageParam = ChatCompletionsAPI.ChatCompletionUserMessageParam; | ||
export import CompletionCreateParams = ChatCompletionsAPI.CompletionCreateParams; | ||
@@ -266,0 +329,0 @@ export import CompletionCreateParamsNonStreaming = ChatCompletionsAPI.CompletionCreateParamsNonStreaming; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const resource_1 = require("../../resource.js"); | ||
const ChatCompletionStream_1 = require("together-ai/lib/ChatCompletionStream"); | ||
class Completions extends resource_1.APIResource { | ||
@@ -11,2 +12,5 @@ create(body, options) { | ||
} | ||
stream(body, options) { | ||
return ChatCompletionStream_1.ChatCompletionStream.createChatCompletion(this._client.chat.completions, body, options); | ||
} | ||
} | ||
@@ -13,0 +17,0 @@ exports.Completions = Completions; |
export { Chat } from "./chat.js"; | ||
export { ChatCompletion, ChatCompletionChunk, ChatCompletionUsage, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, Completions, } from "./completions.js"; | ||
export { ChatCompletion, ChatCompletionAssistantMessageParam, ChatCompletionChunk, ChatCompletionFunctionMessageParam, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionSystemMessageParam, ChatCompletionTool, ChatCompletionToolMessageParam, ChatCompletionUsage, ChatCompletionUserMessageParam, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, Completions, } from "./completions.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -36,18 +36,15 @@ import { APIResource } from "../resource.js"; | ||
export interface LogProbs { | ||
content?: Array<LogProbs.Content>; | ||
/** | ||
* List of token IDs corresponding to the logprobs | ||
*/ | ||
token_ids?: Array<number | null>; | ||
/** | ||
* List of token log probabilities | ||
*/ | ||
token_logprobs?: Array<number>; | ||
token_logprobs?: Array<number | null>; | ||
/** | ||
* List of token strings | ||
*/ | ||
tokens?: Array<string>; | ||
tokens?: Array<string | null>; | ||
} | ||
export declare namespace LogProbs { | ||
interface Content { | ||
token: string; | ||
logprob: number; | ||
} | ||
} | ||
export interface ToolChoice { | ||
@@ -113,3 +110,3 @@ id: string; | ||
/** | ||
* A number between 0 and 1 that can be used as an alternative to temperature. | ||
* A number between 0 and 1 that can be used as an alternative to top-p and top-k. | ||
*/ | ||
@@ -116,0 +113,0 @@ min_p?: number; |
@@ -16,3 +16,3 @@ import { APIResource } from "../resource.js"; | ||
object: string; | ||
type: 'chat' | 'language' | 'code' | 'image' | 'embedding' | 'moderation'; | ||
type: 'chat' | 'language' | 'code' | 'image' | 'embedding' | 'moderation' | 'rerank'; | ||
context_length?: number; | ||
@@ -19,0 +19,0 @@ display_name?: string; |
@@ -16,6 +16,4 @@ /** | ||
import { type Shims } from './registry'; | ||
import { ReadableStream } from 'node:stream/web'; | ||
// @ts-ignore (this package does not have proper export maps for this export) | ||
import { ReadableStream } from 'web-streams-polyfill/dist/ponyfill.es2018.js'; | ||
type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>; | ||
@@ -22,0 +20,0 @@ |
@@ -146,2 +146,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
static Together = this; | ||
static DEFAULT_TIMEOUT = 60000; // 1 minute | ||
@@ -148,0 +149,0 @@ static TogetherError = Errors.TogetherError; |
@@ -13,4 +13,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
export import ChatCompletion = CompletionsAPI.ChatCompletion; | ||
export import ChatCompletionAssistantMessageParam = CompletionsAPI.ChatCompletionAssistantMessageParam; | ||
export import ChatCompletionChunk = CompletionsAPI.ChatCompletionChunk; | ||
export import ChatCompletionFunctionMessageParam = CompletionsAPI.ChatCompletionFunctionMessageParam; | ||
export import ChatCompletionMessage = CompletionsAPI.ChatCompletionMessage; | ||
export import ChatCompletionMessageParam = CompletionsAPI.ChatCompletionMessageParam; | ||
export import ChatCompletionSystemMessageParam = CompletionsAPI.ChatCompletionSystemMessageParam; | ||
export import ChatCompletionTool = CompletionsAPI.ChatCompletionTool; | ||
export import ChatCompletionToolMessageParam = CompletionsAPI.ChatCompletionToolMessageParam; | ||
export import ChatCompletionUsage = CompletionsAPI.ChatCompletionUsage; | ||
export import ChatCompletionUserMessageParam = CompletionsAPI.ChatCompletionUserMessageParam; | ||
export import CompletionCreateParams = CompletionsAPI.CompletionCreateParams; | ||
@@ -17,0 +25,0 @@ export import CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming; |
@@ -9,2 +9,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
import { Stream } from '../../streaming'; | ||
import { ChatCompletionStream, ChatCompletionStreamParams } from "../../lib/ChatCompletionStream"; | ||
@@ -32,2 +33,5 @@ export class Completions extends APIResource { | ||
} | ||
stream(body: ChatCompletionStreamParams, options?: Core.RequestOptions): ChatCompletionStream { | ||
return ChatCompletionStream.createChatCompletion(this._client.chat.completions, body, options); | ||
} | ||
} | ||
@@ -57,3 +61,3 @@ | ||
message?: Choice.Message; | ||
message?: ChatCompletionsAPI.ChatCompletionMessage; | ||
@@ -64,27 +68,27 @@ seed?: number; | ||
} | ||
} | ||
export namespace Choice { | ||
export interface Message { | ||
content: string | null; | ||
export interface ChatCompletionAssistantMessageParam { | ||
role: 'assistant'; | ||
role: 'assistant'; | ||
content?: string | null; | ||
/** | ||
* @deprecated | ||
*/ | ||
function_call?: Message.FunctionCall; | ||
/** | ||
* @deprecated | ||
*/ | ||
function_call?: ChatCompletionAssistantMessageParam.FunctionCall; | ||
tool_calls?: Array<CompletionsAPI.ToolChoice>; | ||
} | ||
name?: string; | ||
export namespace Message { | ||
/** | ||
* @deprecated | ||
*/ | ||
export interface FunctionCall { | ||
arguments: string; | ||
tool_calls?: Array<CompletionsAPI.ToolChoice>; | ||
} | ||
name: string; | ||
} | ||
} | ||
export namespace ChatCompletionAssistantMessageParam { | ||
/** | ||
* @deprecated | ||
*/ | ||
export interface FunctionCall { | ||
arguments: string; | ||
name: string; | ||
} | ||
@@ -113,7 +117,7 @@ } | ||
finish_reason: 'stop' | 'eos' | 'length' | 'tool_calls' | 'function_call'; | ||
finish_reason: 'stop' | 'eos' | 'length' | 'tool_calls' | 'function_call' | null; | ||
index: number; | ||
logprobs?: CompletionsAPI.LogProbs; | ||
logprobs?: number | null; | ||
} | ||
@@ -123,2 +127,4 @@ | ||
export interface Delta { | ||
role: 'system' | 'user' | 'assistant' | 'function' | 'tool'; | ||
content?: string | null; | ||
@@ -131,4 +137,2 @@ | ||
role?: 'system' | 'user' | 'assistant' | 'function' | 'tool'; | ||
token_id?: number; | ||
@@ -152,2 +156,78 @@ | ||
/** | ||
* @deprecated | ||
*/ | ||
export interface ChatCompletionFunctionMessageParam { | ||
content: string; | ||
name: string; | ||
role: 'function'; | ||
} | ||
export interface ChatCompletionMessage { | ||
content: string | null; | ||
role: 'assistant'; | ||
/** | ||
* @deprecated | ||
*/ | ||
function_call?: ChatCompletionMessage.FunctionCall; | ||
tool_calls?: Array<CompletionsAPI.ToolChoice>; | ||
} | ||
export namespace ChatCompletionMessage { | ||
/** | ||
* @deprecated | ||
*/ | ||
export interface FunctionCall { | ||
arguments: string; | ||
name: string; | ||
} | ||
} | ||
export type ChatCompletionMessageParam = | ||
| ChatCompletionSystemMessageParam | ||
| ChatCompletionUserMessageParam | ||
| ChatCompletionAssistantMessageParam | ||
| ChatCompletionToolMessageParam | ||
| ChatCompletionFunctionMessageParam; | ||
export interface ChatCompletionSystemMessageParam { | ||
content: string; | ||
role: 'system'; | ||
name?: string; | ||
} | ||
export interface ChatCompletionTool { | ||
function: ChatCompletionTool.Function; | ||
type: 'function'; | ||
} | ||
export namespace ChatCompletionTool { | ||
export interface Function { | ||
name: string; | ||
description?: string; | ||
parameters?: Record<string, unknown>; | ||
} | ||
} | ||
export interface ChatCompletionToolMessageParam { | ||
content?: string; | ||
required?: unknown; | ||
role?: 'tool'; | ||
tool_call_id?: string; | ||
} | ||
export interface ChatCompletionUsage { | ||
@@ -161,2 +241,10 @@ completion_tokens: number; | ||
export interface ChatCompletionUserMessageParam { | ||
content: string; | ||
role: 'user'; | ||
name?: string; | ||
} | ||
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming; | ||
@@ -206,3 +294,3 @@ | ||
/** | ||
* A number between 0 and 1 that can be used as an alternative to temperature. | ||
* A number between 0 and 1 that can be used as an alternative to top_p and top-k. | ||
*/ | ||
@@ -304,3 +392,3 @@ min_p?: number; | ||
*/ | ||
role: 'system' | 'user' | 'assistant'; | ||
role: 'system' | 'user' | 'assistant' | 'tool'; | ||
} | ||
@@ -351,4 +439,12 @@ | ||
export import ChatCompletion = ChatCompletionsAPI.ChatCompletion; | ||
export import ChatCompletionAssistantMessageParam = ChatCompletionsAPI.ChatCompletionAssistantMessageParam; | ||
export import ChatCompletionChunk = ChatCompletionsAPI.ChatCompletionChunk; | ||
export import ChatCompletionFunctionMessageParam = ChatCompletionsAPI.ChatCompletionFunctionMessageParam; | ||
export import ChatCompletionMessage = ChatCompletionsAPI.ChatCompletionMessage; | ||
export import ChatCompletionMessageParam = ChatCompletionsAPI.ChatCompletionMessageParam; | ||
export import ChatCompletionSystemMessageParam = ChatCompletionsAPI.ChatCompletionSystemMessageParam; | ||
export import ChatCompletionTool = ChatCompletionsAPI.ChatCompletionTool; | ||
export import ChatCompletionToolMessageParam = ChatCompletionsAPI.ChatCompletionToolMessageParam; | ||
export import ChatCompletionUsage = ChatCompletionsAPI.ChatCompletionUsage; | ||
export import ChatCompletionUserMessageParam = ChatCompletionsAPI.ChatCompletionUserMessageParam; | ||
export import CompletionCreateParams = ChatCompletionsAPI.CompletionCreateParams; | ||
@@ -355,0 +451,0 @@ export import CompletionCreateParamsNonStreaming = ChatCompletionsAPI.CompletionCreateParamsNonStreaming; |
@@ -6,4 +6,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
ChatCompletion, | ||
ChatCompletionAssistantMessageParam, | ||
ChatCompletionChunk, | ||
ChatCompletionFunctionMessageParam, | ||
ChatCompletionMessage, | ||
ChatCompletionMessageParam, | ||
ChatCompletionSystemMessageParam, | ||
ChatCompletionTool, | ||
ChatCompletionToolMessageParam, | ||
ChatCompletionUsage, | ||
ChatCompletionUserMessageParam, | ||
CompletionCreateParams, | ||
@@ -10,0 +18,0 @@ CompletionCreateParamsNonStreaming, |
@@ -66,3 +66,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
export interface LogProbs { | ||
content?: Array<LogProbs.Content>; | ||
/** | ||
* List of token IDs corresponding to the logprobs | ||
*/ | ||
token_ids?: Array<number | null>; | ||
@@ -72,3 +75,3 @@ /** | ||
*/ | ||
token_logprobs?: Array<number>; | ||
token_logprobs?: Array<number | null>; | ||
@@ -78,13 +81,5 @@ /** | ||
*/ | ||
tokens?: Array<string>; | ||
tokens?: Array<string | null>; | ||
} | ||
export namespace LogProbs { | ||
export interface Content { | ||
token: string; | ||
logprob: number; | ||
} | ||
} | ||
export interface ToolChoice { | ||
@@ -169,3 +164,3 @@ id: string; | ||
/** | ||
* A number between 0 and 1 that can be used as an alternative to temperature. | ||
* A number between 0 and 1 that can be used as an alternative to top-p and top-k. | ||
*/ | ||
@@ -172,0 +167,0 @@ min_p?: number; |
@@ -26,3 +26,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
type: 'chat' | 'language' | 'code' | 'image' | 'embedding' | 'moderation'; | ||
type: 'chat' | 'language' | 'code' | 'image' | 'embedding' | 'moderation' | 'rerank'; | ||
@@ -29,0 +29,0 @@ context_length?: number; |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '0.6.0-alpha.4'; // x-release-please-version | ||
export const VERSION = '0.6.0-alpha.7'; // x-release-please-version |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.6.0-alpha.4"; | ||
export declare const VERSION = "0.6.0-alpha.7"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '0.6.0-alpha.4'; // x-release-please-version | ||
exports.VERSION = '0.6.0-alpha.7'; // x-release-please-version | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
859198
7
284
13827
- Removedweb-streams-polyfill@^3.2.1
- Removedweb-streams-polyfill@3.3.3(transitive)