UNPKG

@azure/openai-assistants

Version:

An isomorphic client library for Azure OpenAI Assistants.

33 lines 1.22 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import { __rest } from "tslib"; import { camelCaseKeys } from "../api/util.js"; export function parseRequiredToolCallOutput(requiredToolCallOutput) { return { type: "function", id: requiredToolCallOutput.id, function: requiredToolCallOutput.function, }; } export function parseToolCallOutput(toolCallOutput) { const { id, type } = toolCallOutput; switch (type) { case "function": return { type, id, function: toolCallOutput.function }; case "retrieval": return { type, id, retrieval: toolCallOutput.retrieval }; case "code_interpreter": return { type, id, codeInterpreter: parseCodeInterpreterToolCallDetailsOutput(toolCallOutput.code_interpreter), }; default: throw new Error(`Unknown tool call type: ${type}`); } } function parseCodeInterpreterToolCallDetailsOutput(codeInterpreterToolCallDetailsOutput) { const rest = __rest(codeInterpreterToolCallDetailsOutput, []); return Object.assign({}, camelCaseKeys(rest)); } //# sourceMappingURL=helpers.js.map