Michael Jaumann I'm glad that your issue is resolved and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.
Error Message:
Error code: 400 - {'detail': "Extra parameters ['n'] are not allowed when extra-parameters is not set or set to be 'error'. Set extra-parameters to 'pass-through' to pass to the model."}
Solution:
I have found a solution for this by using the OpenAI-compltible endpoint of the mistral model and setting the extra-parameter
header.
from langchain_openai import ChatOpenAI
mistral_model = ChatOpenAI(
default_headers={"extra-parameters": "pass-through"},
base_url=base_url_mistral,
api_key=os.getenv("AZURE_MISTRAL_KEY"),
model=deployment_name_mistral,
)
# This produces an exception.
mistral_model.invoke("hi")
If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.