Skip to main content
This page gives a model on the OpenAI Responses API the PartFinder API as function tools. Your code runs each function call and sends the result back until the model answers.

Install

Save partfinder_tools.py or partfinder-tools.mjs next to your code. It builds the tools from the OpenAPI document and makes each call with the key from PARTFINDER_API_KEY.

Give the model the tools

strict set to false keeps the operations’ optional parameters optional. The loop ends when a response has no function_call item, and output_text is the model’s answer. Save it as agent.py or agent.mjs next to the tools file.

Jobs and refusals

searchParts, compareParts and analyzeBom start a job. call_tool (callTool) waits for the job and returns the finished result, so the model does not need to poll. A refused call returns the API’s JSON with its error code and summary, and the model reads it like any other result. See AI agent integration for the rest of the rules.