IBM / ibm-generative-ai-node-sdk

Library that provides convenient access to the Generative AI API from Node.js applications
MIT License
35 stars 6 forks source link

Error: Chat model must implement ".bindTools()" to use withStructuredOutput #111

Closed playground closed 2 months ago

playground commented 2 months ago

I'm exploring LLMGraphTransformer, it works when try with ChatOpenAI

  model = new ChatOpenAI({
    temperature: 0,
    model: "gpt-4-turbo-preview",
  });

  const llmGraphTransformer = new LLMGraphTransformer({
    llm: model,
  });

However when I try with GenAIChatModel it throws error, what models can I use and how to resolve this?

    const model = new GenAIChatModel({
      model_id: 'meta-llama/llama-3-70b-instruct',    // 
       parameters: params,
      configuration: {
        apiKey: this.apiKey,
      },
    });

langchain-express/node_modules/@langchain/core/dist/language_models/chat_models.cjs:424
            throw new Error(`Chat model must implement ".bindTools()" to use withStructuredOutput.`);
                  ^

Error: Chat model must implement ".bindTools()" to use withStructuredOutput.
    at GenAIChatModel.withStructuredOutput (/langchain-express/node_modules/@langchain/core/dist/language_models/chat_models.cjs:424:19)
    at new LLMGraphTransformer (/langchain-express/node_modules/@langchain/community/dist/experimental/graph_transformers/llm.cjs:156:35)
Tomas2D commented 2 months ago

This feature is not supported.

playground commented 1 month ago

Thanks @Tomas2D-IBM, will support be added in the future?