UNPKG

together-ai-sdk

Version:

A typescript SDK for the Together AI API

61 lines (60 loc) 3.56 kB
import { TogetherChatParams, TogetherChatResponse, TogetherCodeParams, TogetherCodeResponse, TogetherEmbeddingParams, TogetherEmbeddingResponse, TogetherImageParams, TogetherImageResponse, TogetherInferenceParams, TogetherInferenceResponse, TogetherLanguageParams, TogetherLanguageResponse } from './client.types'; import { RawTogetherConfig } from './raw'; export type TogetherClientConfig = Omit<RawTogetherConfig, 'endpoint' | 'requestParams'>; export interface TogetherClient { /** * Queries the chat completion API to produce a chat message from the assistant in response to a chat history * @param params - all of the parameters to send to the API * @see https://docs.together.ai/reference/chat-completions * @throws the response when the status is not 200 or if the body is not present when streaming tokens * @returns the response from the API when it has been completed */ chat: (params: TogetherChatParams) => Promise<TogetherChatResponse>; /** * Queries the language completion API to produce a continuation of the prompt * @param params - all of the parameters to send to the API * @see https://docs.together.ai/reference/completions * @throws the response when the status is not 200 or if the body is not present when streaming tokens * @returns the response from the API when it has been completed */ language: (params: TogetherLanguageParams) => Promise<TogetherLanguageResponse>; /** * Queries the API to produce any result * @deprecated please use other endpoints * @param params - all of the parameters to send to the API * @see https://docs.together.ai/reference/inference * @throws the response when the status is not 200 or if the body is not present when streaming tokens * @returns the response from the API when it has been completed */ inference: (params: TogetherInferenceParams) => Promise<TogetherInferenceResponse>; /** * Queries the code completion API to produce a continuation of the prompt * @param params - all of the parameters to send to the API * @see https://docs.together.ai/reference/completions * @throws the response when the status is not 200 or if the body is not present when streaming tokens * @returns the response from the API when it has been completed */ code: (params: TogetherCodeParams) => Promise<TogetherCodeResponse>; /** * Queries the embedding API to produce an embedding vector for the input * @param params - all of the parameters to send to the API * @see https://docs.together.ai/reference/embeddings * @throws the response when the status is not 200 * @returns the response from the API when it has been completed */ embedding: (params: TogetherEmbeddingParams) => Promise<TogetherEmbeddingResponse>; /** * Queries the image creation API to produce an image from the prompt * @param params - all of the parameters to send to the API * @see https://docs.together.ai/reference/completions * @throws the response when the status is not 200 * @returns the response from the API when it has been completed */ image: (params: TogetherImageParams) => Promise<TogetherImageResponse>; } /** * The complete together client with all of the endpoints * @param config - a configuration object to use for the client * @returns the client to use to send requests to the Together API */ export declare const togetherClient: (config: TogetherClientConfig) => TogetherClient;