Skip to content

armgit / dspy

Public Imported from GitHub
0

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.py
index a6865016c..baac5ef89 100644
--- a/dsp/modules/mistral.py
+++ b/dsp/modules/mistral.py
@@ -5,8 +5,9 @@ import backoff
from dsp.modules.lm import LM
from dsp.utils.settings import settings
+mistralai_api_error = None
try:
- from mistralai.client import MistralClient
+ from mistralai import Mistral as MistralAI
from mistralai.models.usermessage import UserMessage
except 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.toml
index 80d3878ea..df60b35e9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
#replace_package_name_marker
name="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]" }]