Closed ShreyasChhetri closed 3 months ago
Works for me.
Can you give more details about your issue? What's your local environment? What's your python version? Can you update the CA certificates?
My python version is 3.11.2 my local environment is VS code inside a Z4 European VDI can you elaborate more about the CA certificate part ?
In cryptography, a certificate authority or certification authority (CA) is an entity that stores, signs, and issues digital certificates. A digital certificate certifies the ownership of a public key by the named subject of the certificate. This allows others (relying parties) to rely upon signatures or on assertions made about the private key that corresponds to the certified public key. A CA acts as a trusted third party—trusted both by the subject (owner) of the certificate and by the party relying upon the certificate.
One particularly common use for certificate authorities is to sign certificates used in HTTPS
According to Certificate_authority.
Your particular error SSL: CERTIFICATE_VERIFY_FAILED
means that your environment couldn't verify the SSL certificate used by MistralAI's servers. I'm not sure about all the causes that could lead to this, but one is your environment not trusting the CA that's issuing the SSL certificate to MistralAI.
I am not familiar with VDI so I can't help further. But maybe it's a security related issue? You can check your system's trusted certificates. I checked the CA certificates chain for api.mistral.ai
and the root certificate's common name is GTS Root R1
. You should check if it's available in the authorised certificates of your system. I'm using a MacOS and it's in Keychain Access/System Roots
.
With mistralai v1.0.0, you can specify the http client with verify=False:
from mistralai import Mistral
from mistralai.models import UserMessage
import os
import httpx
api_key = os.environ["MISTRAL_API_KEY"]
model = "mistral-large-latest"
client = Mistral(api_key=api_key, client=httpx.Client(verify=False))
chat_response = client.chat.complete(
model=model,
messages=[UserMessage(content="What is the best French cheese?")],
)
print(chat_response.choices[0].message.content)
Thanks @pyvandenbussche for the response. Closing the issue.
Hi I want to use Mistral 7B model in my local system but when I'm running this specific piece of code from mistralai.client import MistralClient from mistralai.models.chat_completion import ChatMessage import os
api_key=os.getenv("MistralAI_API_KEY") model = "mistral-large-latest"
client = MistralClient(api_key=api_key)
messages = [ ChatMessage(role="user", content="What is thecapital of india in one line?") ]
No streaming
chat_response = client.chat( model=model, messages=messages, )
print(chat_response.choices[0].message.content)
I'm getting an error of mistralai.exceptions.MistralConnectionException: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992) can anybody help or have any inputs of how to solve this