@nomyx/assistant
Version:
A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)
39 lines (38 loc) • 1.61 kB
TypeScript
import { ChatMessage, FunctionCall, ProviderResponse } from '../../../types/chat';
import { GenericToolSchema, ParameterDefinition, StandardizedToolCall } from '../../../types/tool';
interface OpenRouterMessage {
role: string;
content: string;
name?: string;
tool_calls?: OpenRouterToolCall[];
}
interface OpenRouterToolCall {
name: string;
arguments?: Record<string, string>;
}
interface OpenRouterFunction {
name: string;
description: string;
parameters: {
type: string;
properties: Record<string, ParameterDefinition>;
required: string[];
};
}
export declare function convertMessages(messages: ChatMessage[], model: string): OpenRouterMessage[];
export declare function convertFunctionCall(functionCall: FunctionCall): {
name: string;
arguments: string;
};
export declare function convertToolSchema(schema: GenericToolSchema): OpenRouterFunction;
export declare function convertParameters(params: Record<string, ParameterDefinition>): Record<string, ParameterDefinition>;
export declare function convertParameterDefinition(param: ParameterDefinition): ParameterDefinition;
export declare function convertToolCall(call: OpenRouterToolCall): StandardizedToolCall;
export declare function validateToolCall(toolCall: StandardizedToolCall): void;
export declare function convertToolCalls(toolCalls: OpenRouterToolCall[] | undefined): StandardizedToolCall[];
export declare function convertUsage(usage: {
prompt_tokens?: number;
completion_tokens?: number;
total_tokens?: number;
} | undefined): ProviderResponse['usage'];
export {};