var o=class{formatTools(e){throw new Error("formatTools() must be implemented")}hasToolCalls(e){throw new Error("hasToolCalls() must be implemented")}parseToolCalls(e){throw new Error("parseToolCalls() must be implemented")}getTextContent(e){throw new Error("getTextContent() must be implemented")}buildAssistantMessage(e){throw new Error("buildAssistantMessage() must be implemented")}buildToolResultMessage(e,s){throw new Error("buildToolResultMessage() must be implemented")}injectToolsIntoBody(e,s){throw new Error("injectToolsIntoBody() must be implemented")}};var l=class extends o{formatTools(e){return e.map(s=>({type:"function",function:{name:s.name,description:s.description,parameters:s.parameters||s.input_schema||{type:"object",properties:{}}}}))}hasToolCalls(e){let s=e.choices?.[0]?.message;return!!(s?.tool_calls&&s.tool_calls.length>0)}parseToolCalls(e){return(e.choices?.[0]?.message?.tool_calls||[]).map(t=>({id:t.id,name:t.function.name,args:JSON.parse(t.function.arguments||"{}")}))}getTextContent(e){return e.choices?.[0]?.message?.content||""}buildAssistantMessage(e){return e.choices?.[0]?.message}buildToolResultMessage(e,s){return{role:"tool",tool_call_id:e,content:typeof s=="string"?s:JSON.stringify(s)}}injectToolsIntoBody(e,s){return s.length>0&&(e.tools=s),e}};export{l as OpenAIToolProvider};
