-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #531 from skylarbpayne/bump-mistral
Bump mistralai to > 1.0.0 in preparation for latest models such as Pixtral
- Loading branch information
Showing
57 changed files
with
814 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
examples/learn/async/custom_client/decorator/mistral/base_message_param.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import os | ||
|
||
from mirascope.core import BaseMessageParam, mistral | ||
from mistralai.async_client import MistralAsyncClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest", client=MistralAsyncClient()) | ||
@mistral.call( | ||
"mistral-large-latest", client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]) | ||
) | ||
async def recommend_book_async(genre: str) -> list[BaseMessageParam]: | ||
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")] |
8 changes: 6 additions & 2 deletions
8
examples/learn/async/custom_client/decorator/mistral/messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import os | ||
|
||
from mirascope.core import Messages, mistral | ||
from mistralai.async_client import MistralAsyncClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest", client=MistralAsyncClient()) | ||
@mistral.call( | ||
"mistral-large-latest", client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]) | ||
) | ||
async def recommend_book_async(genre: str) -> Messages.Type: | ||
return Messages.User(f"Recommend a {genre} book") |
8 changes: 6 additions & 2 deletions
8
examples/learn/async/custom_client/decorator/mistral/shorthand.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import os | ||
|
||
from mirascope.core import mistral | ||
from mistralai.async_client import MistralAsyncClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest", client=MistralAsyncClient()) | ||
@mistral.call( | ||
"mistral-large-latest", client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]) | ||
) | ||
async def recommend_book_async(genre: str) -> str: | ||
return f"Recommend a {genre} book" |
8 changes: 6 additions & 2 deletions
8
examples/learn/async/custom_client/decorator/mistral/string_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import os | ||
|
||
from mirascope.core import mistral, prompt_template | ||
from mistralai.async_client import MistralAsyncClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest", client=MistralAsyncClient()) | ||
@mistral.call( | ||
"mistral-large-latest", client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]) | ||
) | ||
@prompt_template("Recommend a {genre} book") | ||
async def recommend_book_async(genre: str): ... |
8 changes: 5 additions & 3 deletions
8
examples/learn/async/custom_client/dynamic_configuration/mistral/base_message_param.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import os | ||
|
||
from mirascope.core import BaseMessageParam, mistral | ||
from mistralai.async_client import MistralAsyncClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest") | ||
async def recommend_book(genre: str) -> mistral.AsyncMistralDynamicConfig: | ||
async def recommend_book(genre: str) -> mistral.MistralDynamicConfig: | ||
return { | ||
"messages": [ | ||
BaseMessageParam(role="user", content=f"Recommend a {genre} book") | ||
], | ||
"client": MistralAsyncClient(), | ||
"client": Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
} |
8 changes: 5 additions & 3 deletions
8
examples/learn/async/custom_client/dynamic_configuration/mistral/messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import os | ||
|
||
from mirascope.core import Messages, mistral | ||
from mistralai.async_client import MistralAsyncClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest") | ||
async def recommend_book(genre: str) -> mistral.AsyncMistralDynamicConfig: | ||
async def recommend_book(genre: str) -> mistral.MistralDynamicConfig: | ||
return { | ||
"messages": [Messages.User(f"Recommend a {genre} book")], | ||
"client": MistralAsyncClient(), | ||
"client": Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
} |
8 changes: 5 additions & 3 deletions
8
examples/learn/async/custom_client/dynamic_configuration/mistral/shorthand.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import os | ||
|
||
from mirascope.core import mistral, Messages | ||
from mistralai.async_client import MistralAsyncClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest") | ||
async def recommend_book(genre: str) -> mistral.AsyncMistralDynamicConfig: | ||
async def recommend_book(genre: str) -> mistral.MistralDynamicConfig: | ||
return { | ||
"messages": [Messages.User(f"Recommend a {genre} book")], | ||
"client": MistralAsyncClient(), | ||
"client": Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
} |
8 changes: 5 additions & 3 deletions
8
examples/learn/async/custom_client/dynamic_configuration/mistral/string_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import os | ||
|
||
from mirascope.core import mistral, prompt_template | ||
from mistralai.async_client import MistralAsyncClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest") | ||
@prompt_template("Recommend a {genre} book") | ||
async def recommend_book(genre: str) -> mistral.AsyncMistralDynamicConfig: | ||
async def recommend_book(genre: str) -> mistral.MistralDynamicConfig: | ||
return { | ||
"client": MistralAsyncClient(), | ||
"client": Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
} |
14 changes: 9 additions & 5 deletions
14
examples/learn/calls/basic_usage/mistral/official_sdk_call.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 15 additions & 2 deletions
17
examples/learn/calls/custom_client/decorator/mistral/base_message_param.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import os | ||
|
||
from mirascope.core import BaseMessageParam, mistral | ||
from mistralai.client import MistralClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest", client=MistralClient()) | ||
@mistral.call( | ||
"mistral-large-latest", | ||
client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
) | ||
def recommend_book(genre: str) -> list[BaseMessageParam]: | ||
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")] | ||
|
||
|
||
@mistral.call( | ||
"mistral-large-latest", | ||
client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
) | ||
async def recommend_book_async(genre: str) -> list[BaseMessageParam]: | ||
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")] |
17 changes: 15 additions & 2 deletions
17
examples/learn/calls/custom_client/decorator/mistral/messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import os | ||
|
||
from mirascope.core import Messages, mistral | ||
from mistralai.client import MistralClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest", client=MistralClient()) | ||
@mistral.call( | ||
"mistral-large-latest", | ||
client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
) | ||
def recommend_book(genre: str) -> Messages.Type: | ||
return Messages.User(f"Recommend a {genre} book") | ||
|
||
|
||
@mistral.call( | ||
"mistral-large-latest", | ||
client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
) | ||
async def recommend_book_async(genre: str) -> Messages.Type: | ||
return Messages.User(f"Recommend a {genre} book") |
17 changes: 15 additions & 2 deletions
17
examples/learn/calls/custom_client/decorator/mistral/shorthand.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import os | ||
|
||
from mirascope.core import mistral | ||
from mistralai.client import MistralClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest", client=MistralClient()) | ||
@mistral.call( | ||
"mistral-large-latest", | ||
client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
) | ||
def recommend_book(genre: str) -> str: | ||
return f"Recommend a {genre} book" | ||
|
||
|
||
@mistral.call( | ||
"mistral-large-latest", | ||
client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
) | ||
async def recommend_book_async(genre: str) -> str: | ||
return f"Recommend a {genre} book" |
17 changes: 15 additions & 2 deletions
17
examples/learn/calls/custom_client/decorator/mistral/string_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import os | ||
|
||
from mirascope.core import mistral, prompt_template | ||
from mistralai.client import MistralClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest", client=MistralClient()) | ||
@mistral.call( | ||
"mistral-large-latest", | ||
client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
) | ||
@prompt_template("Recommend a {genre} book") | ||
def recommend_book(genre: str): ... | ||
|
||
|
||
@mistral.call( | ||
"mistral-large-latest", | ||
client=Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
) | ||
@prompt_template("Recommend a {genre} book") | ||
async def recommend_book_async(genre: str): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
examples/learn/calls/custom_client/dynamic_configuration/mistral/messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import os | ||
|
||
from mirascope.core import Messages, mistral | ||
from mistralai.client import MistralClient | ||
from mistralai import Mistral | ||
|
||
|
||
@mistral.call("mistral-large-latest") | ||
def recommend_book(genre: str) -> mistral.MistralDynamicConfig: | ||
return { | ||
"messages": [Messages.User(f"Recommend a {genre} book")], | ||
"client": MistralClient(), | ||
"client": Mistral(api_key=os.environ["MISTRAL_API_KEY"]), | ||
} |
Oops, something went wrong.