langchain.js
    Preparing search index...

    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({ model: "gpt-4o-mini", 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 Summary)

    Index

    Constructors

    Properties

    Constructors

    • Parameters

      • jsonSpec: JsonSpec
      • llm: BaseLanguageModelInterface
      • Optionalheaders: Headers

      Returns OpenApiToolkit

    Properties

    tools: ToolInterface[]