UNPKG

openai-agents

Version:

A TypeScript library extending the OpenAI Node.js SDK for building highly customizable agents and simplifying 'function calling'. Easily create and manage tools to extend LLM capabilities.

16 lines 1.04 kB
import { ChatCompletion, ChatCompletionCreateParamsNonStreaming, CompletionUsage } from 'openai/resources'; import { ResponseChoices } from './types'; /** * Calculates the sum of prompt tokens, completion tokens, and total tokens from multiple `CompletionUsage` objects. */ export declare const getTokensSum: (...usages: CompletionUsage[]) => CompletionUsage; /** * Extracts and aggregates the `usage` information from multiple `ChatCompletion` objects. * * @param {...ChatCompletion} completions - One or more `ChatCompletion` objects. * @returns {CompletionUsage} A `CompletionUsage` object representing the aggregated usage data. * Returns an object with all properties set to 0 if no completions are provided or if none of them have a usage property. */ export declare const getCompletionsUsage: (...completions: ChatCompletion[]) => CompletionUsage; export declare const handleNResponses: (response: ChatCompletion, queryParams: ChatCompletionCreateParamsNonStreaming) => ResponseChoices; //# sourceMappingURL=utils.d.ts.map