@hashbrownai/core
Version:
Runtime helpers for Hashbrown AI
67 lines • 2.58 kB
TypeScript
import * as Chat from './public_api';
import { s } from '../schema';
/**
* Converts a view message to an internal message.
*
* @param message - The view message to convert.
* @returns The internal message.
* @internal
*/
export declare function toInternalMessagesFromView(message: Chat.AnyMessage): Chat.Internal.Message[];
/**
* Converts an internal message to a view message.
*
* @param message - The internal message to convert.
* @returns The view message.
* @internal
*/
export declare function toViewMessagesFromInternal(message: Chat.Internal.Message, toolCalls: Record<string, Chat.Internal.ToolCall>, tools: Chat.AnyTool[], outputSchema?: s.HashbrownType, streaming?: boolean): Chat.AnyMessage[];
/**
* Converts an internal message to an API message.
*
* @param message - The internal message to convert.
* @param toolCalls - The tool calls to convert.
* @returns The API message.
* @internal
*/
export declare function toApiMessagesFromInternal(message: Chat.Internal.Message, toolCalls: Chat.Internal.ToolCall[]): Chat.Api.Message[];
/**
* Converts an internal tool to an API tool.
*
* @param tool - The internal tool to convert.
* @returns The API tool.
* @internal
*/
export declare function toApiToolsFromInternal(tools: Chat.Internal.Tool[], emulateStructuredOutput: boolean, outputSchema: s.HashbrownType): Chat.Api.Tool[];
/**
* Converts an API tool call to an internal tool call.
*
* @param toolCall - The API tool call to convert.
* @returns The internal tool calls.
* @internal
*/
export declare function toInternalToolCallsFromApi(toolCall: Chat.Api.ToolCall): Chat.Internal.ToolCall[];
/**
* Converts a list of API messages (e.g., when hydrating a thread) into
* internal tool call entities, stitching together assistant tool calls and
* their corresponding tool results.
* @internal
*/
export declare function toInternalToolCallsFromApiMessages(messages?: Chat.Api.Message[]): Chat.Internal.ToolCall[];
/**
* Converts a view message to an internal tool call.
*
* @param message - The view message to convert.
* @returns The internal tool calls.
* @internal
*/
export declare function toInternalToolCallsFromView(messages: Chat.AnyMessage[]): Chat.Internal.ToolCall[];
/**
* Converts an API assistant message to an internal assistant message.
*
* @param message - The API assistant message to convert.
* @returns The internal assistant message.
* @internal
*/
export declare function toInternalMessagesFromApi(message: Chat.Api.Message): Chat.Internal.Message[];
//# sourceMappingURL=internal_helpers.d.ts.map