DSPy: The framework for programming—not prompting—language models
Python
Upgrade mistral library from 0.4 to 1.0
Manu Bhardwaje187b572b148
diff --git a/dsp/modules/mistral.py b/dsp/modules/mistral.pyindex a6865016c..baac5ef89 100644--- a/dsp/modules/mistral.py+++ b/dsp/modules/mistral.py@@ -5,8 +5,9 @@ import backofffrom dsp.modules.lm import LMfrom dsp.utils.settings import settings+mistralai_api_error = Nonetry:- from mistralai.client import MistralClient+ from mistralai import Mistral as MistralAIfrom mistralai.models.usermessage import UserMessageexcept ImportError:mistralai_api_error = Exception@@ -58,7 +59,7 @@ class Mistral(LM):"Not loading Mistral AI because it is not installed. Install it with `pip install mistralai`.")- self.client = MistralClient(api_key=api_key)+ self.client = MistralAI(api_key=api_key)self.provider = "mistral"self.kwargs = {@@ -84,7 +85,7 @@ class Mistral(LM):if n is not None and n > 1 and kwargs["temperature"] == 0.0:kwargs["temperature"] = 0.7- response = self.client.chat(**kwargs)+ response = self.client.chat.complete(**kwargs)history = {"prompt": prompt,diff --git a/pyproject.toml b/pyproject.tomlindex 80d3878ea..df60b35e9 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"#replace_package_name_markername="dspy-ai"#replace_package_version_marker-version="2.4.10"+version="2.4.12"description = "DSPy"readme = "README.md"authors = [{ name = "Omar Khattab", email = "[email protected]" }]