Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 400 API mistralAI #5335

Open
abelBEDOYA opened this issue Dec 18, 2024 · 3 comments
Open

Error 400 API mistralAI #5335

abelBEDOYA opened this issue Dec 18, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@abelBEDOYA
Copy link

abelBEDOYA commented Dec 18, 2024

Bug Description

Hello,

I've been using langlfow to build a chatbot, a RAG and now an agent which can access a calculator tool.
Using OpenAI model with its key works fine. However when I try so with MistralAI it runs into this error:

An error occured in the Agent Component, stopping your flow. See below for more details.
Error details:
HTTPStatusError

    Details: Error response 400 while fetching https://api.mistral.ai/v1/chat/completions: {"object":"error","message":"Tool call id has to be defined.","type":"invalid_request_error","param":null,"code":null}

The mistral model that is been used is misrtal-large-latest. If the model doesn't conclude that the tool has to be used, the chat doesn't run into this error. This happens with every model.

Screenshot from 2024-12-18 14-28-38

Screenshot from 2024-12-18 14-30-26

Screenshot from 2024-12-18 14-30-36

Reproduction

  1. Run langflow with docker:
    docker compose up

with this docker

version: "3.8"

services:
  langflow:
    image: langflowai/langflow:latest # or another version tag on https://hub.docker.com/r/langflowai/langflow 
    pull_policy: always               # set to 'always' when using 'latest' image
    ports:
      - "7860:7860"
    depends_on:
      - postgres
    environment:
      - LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@postgres:5432/langflow
      # This variable defines where the logs, file storage, monitor data and secret keys are stored.
    volumes:
      - langflow-data:/app/langflow
  1. Set the calculator agent flow
  2. Ask for a calculation result

Expected behavior

A new message which depends on the outcome of the calculator (calculator tool should have been used) with the correct result.

Who can help?

No response

Operating System

Ubuntu 22.04 (docker)

Langflow Version

1.1.1

Python Version

3.11

Screenshot

No response

Flow File

Simple Agent.json

@abelBEDOYA abelBEDOYA added the bug Something isn't working label Dec 18, 2024
Copy link

dosubot bot commented Dec 18, 2024

Hey @abelBEDOYA! I'm here to help you out with any bugs, questions, or contributions you might have. Let's get this issue sorted out together!

The error you're encountering, "Tool call id has to be defined," suggests that the request to the MistralAI API is missing a required parameter or field related to the tool call ID. This is a common issue when the API expects a specific identifier for tool calls, which might not be automatically generated or included in your current setup.

Here are a few steps you can take to troubleshoot and potentially resolve this issue:

  1. Check Tool Call Configuration: Ensure that the tool call ID is correctly configured in your Langflow setup. This might involve explicitly setting or generating a tool call ID when making requests to the MistralAI API.

  2. Review API Documentation: Verify the MistralAI API documentation to understand the requirements for tool call requests. There might be specific fields or parameters that need to be included in the request payload.

  3. Inspect Flow Configuration: Double-check the configuration of your agent and tool components in Langflow. Ensure that all necessary parameters are set and that the flow logic correctly triggers the tool call with the required identifiers.

  4. Debugging: Add logging or debugging statements to your Langflow setup to capture the exact request payload being sent to the MistralAI API. This can help identify any missing fields or incorrect values.

  5. Update Langflow: Ensure you are using the latest version of Langflow, as updates might include bug fixes or improvements related to API integrations.

If these steps do not resolve the issue, you may need to delve deeper into the Langflow codebase or consult additional resources to understand how tool call IDs are managed and passed to the MistralAI API.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@CodiTrixta
Copy link

I have just got this issue today, have you figured out what the issue is?

Ive had a look and made sure both 'id' and 'tool_call_id' are not None and am still getting the same result

@vigneshethiraj
Copy link

Facing this issue since 18-Dec, I tried using Langgraph but the problem remains the same. Mistral api is expecting the tool_call_id but Langgraph doesn't seem to send that in the expected format after tool call.
Please update if you find a solution to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants