UNPKG

venice-ai-sdk-apl

Version:

A comprehensive SDK for the Venice AI API with CLI support, programmatic CLI usage, CLI-style interface, and interactive demo

81 lines (80 loc) 2.47 kB
/** * Chat Completions Resource * * This module provides methods for interacting with the Chat Completions API. * It allows you to generate text responses in a chat-like format. * * @example * ```typescript * import { VeniceAI } from 'venice-ai-sdk-apl'; * * const venice = new VeniceAI({ * apiKey: 'your-api-key', * }); * * // Generate a chat completion * const response = await venice.chat.completions.create({ * model: 'llama-3.3-70b', * messages: [ * { role: 'system', content: 'You are a helpful assistant' }, * { role: 'user', content: 'Tell me about AI' } * ], * venice_parameters: { * enable_web_search: 'on', * include_venice_system_prompt: true * } * }); * * console.log(response.choices[0].message.content); * ``` */ import { BaseResource } from '../base-resource'; import { CreateChatCompletionParams, ChatCompletionResponse, ChatCompletionChunk } from '../../types/chat'; /** * Chat Completions Resource */ export declare class ChatCompletionsResource extends BaseResource { /** * Creates a chat completion * * @param params - Parameters for creating a chat completion * @returns Promise that resolves with the chat completion response * * @example * ```typescript * const response = await venice.chat.completions.create({ * model: 'llama-3.3-70b', * messages: [ * { role: 'system', content: 'You are a helpful assistant' }, * { role: 'user', content: 'Tell me about AI' } * ] * }); * ``` */ create(params: CreateChatCompletionParams): Promise<ChatCompletionResponse>; /** * Creates a streaming chat completion * * @param params - Parameters for creating a chat completion * @returns Promise that resolves with a readable stream of chat completion chunks * * @example * ```typescript * const stream = await venice.chat.completions.createStream({ * model: 'llama-3.3-70b', * messages: [ * { role: 'system', content: 'You are a helpful assistant' }, * { role: 'user', content: 'Tell me about AI' } * ], * stream: true * }); * * for await (const chunk of stream) { * process.stdout.write(chunk.choices[0]?.delta?.content || ''); * } * ``` */ createStream(params: CreateChatCompletionParams & { stream: true; }): Promise<AsyncIterable<ChatCompletionChunk>>; }