Extends the RequestsToolkit class and adds a dynamic tool for exploring JSON data. It creates a JSON agent using the JsonToolkit and the provided language model, and adds the JSON explorer tool to the toolkit.

const toolkit = new OpenApiToolkit(
new JsonSpec({
}),
new ChatOpenAI({ temperature: 0 }),
{
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
},
);

const result = await toolkit.invoke({
input:
"Make a POST request to openai /completions. The prompt should be 'tell me a joke.'",
});
console.log(`Got output ${result.output}`);

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

tools: ToolInterface<ZodObjectAny>[]

Methods

  • Returns StructuredToolInterface<ZodObjectAny>[]