[Python] How to send context between multiple Mistral AI api call to keep conversation like a...

Discussão em 'Python' iniciado por Stack, Março 1, 2025.

  1. Stack

    Stack Membro Participativo

    I want to create a chat bot like using Mistral AI api. But Api respond like a new start between each call and it does not keep the context. Here is my python code (from documentation):

    import os
    from mistralai import Mistral

    api_key = "my api key"

    client = Mistral(api_key=api_key)

    chat_response = client.agents.complete(
    agent_id="my agent id",
    messages = [
    {
    "role": "user",
    "content": "Hello",
    },
    ]
    )
    print(chat_response.choices[0].message.content)


    How to send context between each call?

    Continue reading...

Compartilhe esta Página