Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
ef68d28
Begin of Mistral implementation
YanSte Dec 7, 2024
1c4d53c
Code cleaning
YanSte Dec 7, 2024
3b6c0f7
Adjusted tools
YanSte Dec 8, 2024
6bcd3f7
Adjusted chunk and cost
YanSte Dec 8, 2024
0996199
Adjusted from dict or json argument
YanSte Dec 8, 2024
a344144
Cleaned imports
YanSte Dec 8, 2024
6b214e8
Added models and format str
YanSte Dec 8, 2024
c3b9333
Cleaned import
YanSte Dec 8, 2024
3ac2f06
Adjusted content generation
YanSte Dec 8, 2024
a8f8c20
Cleaned code
YanSte Dec 8, 2024
4e9bfea
Fix json import
YanSte Dec 8, 2024
32eb862
Added notebook
YanSte Dec 8, 2024
d9bdca7
Cleaned code
YanSte Dec 8, 2024
0dce17b
Added Stream
YanSte Dec 8, 2024
561c074
Updated notebook
YanSte Dec 8, 2024
f17c20b
Adjusted tool streaming
YanSte Dec 8, 2024
3ef3e97
Merge remote-tracking branch 'origin/main' into mistral
YanSte Dec 8, 2024
90d2ff2
Adjusted check
YanSte Dec 8, 2024
5b0b75a
Updated stream generator
YanSte Dec 9, 2024
885c150
Update with last pydantic version
YanSte Dec 9, 2024
651e1b7
Cleanup code
YanSte Dec 9, 2024
60b78b0
Solved with json mode
YanSte Dec 9, 2024
8a6b927
Adjusted json mode for tool
YanSte Dec 9, 2024
c5b3cef
Fixed tool and json mode
YanSte Dec 9, 2024
ce0e1bd
Added json repair
YanSte Dec 9, 2024
c2a2d5f
Pre final of json mode
YanSte Dec 9, 2024
f806e5f
Added Mistral launchs
YanSte Dec 10, 2024
9336a80
Code cleanup
YanSte Dec 10, 2024
a87fa4b
Merge branch 'main' into mistral
YanSte Dec 10, 2024
adbc996
Added ready Mistral
YanSte Dec 10, 2024
8602740
Code cleanup
YanSte Dec 10, 2024
d22978f
Optimised Algo
YanSte Dec 10, 2024
5dacdaa
Fixed continue
YanSte Dec 10, 2024
3eddc6c
Optimised Algo
YanSte Dec 10, 2024
f8b6ea9
Optimised Algo
YanSte Dec 10, 2024
a6a37d5
Added documentations and cleaned code
YanSte Dec 10, 2024
fbd5464
Clean code
YanSte Dec 10, 2024
2dc31fa
Fixed version
YanSte Dec 10, 2024
9e136b7
Fixed lint
YanSte Dec 10, 2024
9adfc30
Fixed lint
YanSte Dec 10, 2024
e573571
Fixed type check
YanSte Dec 10, 2024
99df763
Fixed wrong import
YanSte Dec 10, 2024
f4e954b
Fixed typo
YanSte Dec 10, 2024
4628884
Merge remote-tracking branch 'origin/main' into mistral
YanSte Dec 10, 2024
1550959
Updated from master
YanSte Dec 10, 2024
7f9a4d6
Updated uv lock
YanSte Dec 10, 2024
0b6bab2
Update tool choice
YanSte Dec 10, 2024
ec0b242
Fixed tool and cleanup code
YanSte Dec 10, 2024
8608724
Optimised code
YanSte Dec 11, 2024
f35c235
Fixed infinity loop
YanSte Dec 11, 2024
52b521b
Clean code
YanSte Dec 11, 2024
7a32e41
Added first test mistral
YanSte Dec 11, 2024
f832cbb
Cleanup test
YanSte Dec 11, 2024
fc9cfab
Added first part of stream tests
YanSte Dec 11, 2024
a5c8cd7
Added completion and completion Stream tests
YanSte Dec 11, 2024
febafec
Cleaned code
YanSte Dec 11, 2024
3d18b7a
Update pyproject.toml
YanSte Dec 11, 2024
33ca07e
Adjusted import for test
YanSte Dec 11, 2024
cc14b4c
Added completion model structured
YanSte Dec 11, 2024
eca64b4
Added tests model structured and result type
YanSte Dec 11, 2024
456fad1
Merge remote-tracking branch 'origin/main' into mistral
YanSte Dec 11, 2024
27b3a5f
Cleaned merge with new tool id
YanSte Dec 12, 2024
58ea5df
Optimised tool call
YanSte Dec 12, 2024
ca29d1f
Updated tests code style
YanSte Dec 12, 2024
495cc19
Cleaned documentation and todo
YanSte Dec 12, 2024
5362c1e
Cleaned documentation and fixed none delta
YanSte Dec 12, 2024
ee5a2f8
Added Tests Completion Function call and costs
YanSte Dec 12, 2024
2b2fd18
Update pydantic_ai_slim/pydantic_ai/models/mistral.py
YanSte Dec 12, 2024
027bd22
Update pydantic_ai_slim/pydantic_ai/models/mistral.py
YanSte Dec 12, 2024
0b13ded
Update pydantic_ai_slim/pydantic_ai/models/mistral.py
YanSte Dec 12, 2024
5702967
Update pydantic_ai_slim/pydantic_ai/models/mistral.py
YanSte Dec 12, 2024
71e071f
Update pyproject.toml
YanSte Dec 12, 2024
122fef3
Update pydantic_ai_slim/pydantic_ai/models/mistral.py
YanSte Dec 12, 2024
c65cba3
Update pydantic_ai_slim/pydantic_ai/models/mistral.py
YanSte Dec 12, 2024
a7695b2
Update pydantic_ai_slim/pydantic_ai/models/mistral.py
YanSte Dec 12, 2024
086dee9
Update pydantic_ai_slim/pydantic_ai/models/mistral.py
YanSte Dec 12, 2024
44bce87
Update model name
YanSte Dec 12, 2024
c825664
Applied return for none from PR
YanSte Dec 12, 2024
c9e62d3
Merge remote-tracking branch 'origin/main' into mistral
YanSte Dec 12, 2024
277b6fb
Fixed cost and stream value
YanSte Dec 12, 2024
d1b5607
Added tests stream structured
YanSte Dec 12, 2024
e59cb4a
Fixed test on cost
YanSte Dec 12, 2024
ef889ed
Fixed JSON crash from required params from json shema response and pr…
YanSte Dec 12, 2024
b870e27
Added tests stream result type
YanSte Dec 12, 2024
51aae05
Merge remote-tracking branch 'origin/main' into mistral
YanSte Dec 12, 2024
57e8346
Cleaned typo none
YanSte Dec 12, 2024
bc16607
Fixed missing system and stream required function tool
YanSte Dec 12, 2024
b29c930
Fix tool choice for step selection and result
YanSte Dec 13, 2024
a04af22
Added test request tool call with result type
YanSte Dec 13, 2024
78fc5d4
Improved simple json generation and added tests
YanSte Dec 13, 2024
23bb384
Added test stream request tool call
YanSte Dec 13, 2024
27ed109
Merge branch 'main' into mistral
dmontagu Dec 13, 2024
c04cf85
Added final test with stream tool call with return type
YanSte Dec 14, 2024
b5537c2
Merge remote-tracking branch 'origin/main' into mistral
YanSte Dec 14, 2024
a904b50
Fix issues after merging with main
dmontagu Dec 14, 2024
7cb1c48
Fix issues after merging main
dmontagu Dec 14, 2024
7b657ab
Added raise for type not take and tests
YanSte Dec 14, 2024
f2d7736
Cleaned comments
YanSte Dec 14, 2024
76e59c9
Added tests on schema
YanSte Dec 14, 2024
053b7eb
Added tests with cover mistral chunk text
YanSte Dec 14, 2024
5f1f41f
Cleaned code
YanSte Dec 14, 2024
f840459
Fixed mistral api error 'not the same number of function calls and re…
YanSte Dec 14, 2024
33096ce
Added final test on json validation
YanSte Dec 14, 2024
05952d9
fix model name bugs, and add documentation
samuelcolvin Dec 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PydanticAI is a Python Agent Framework designed to make it less painful to build
## Why use PydanticAI

* Built by the team behind Pydantic (the validation layer of the OpenAI SDK, the Anthropic SDK, LangChain, LlamaIndex, AutoGPT, Transformers, CrewAI, Instructor and many more)
* Model-agnostic — currently OpenAI, Gemini, Anthropic, and Groq are supported. And there is a simple interface to implement support for other models.
* Model-agnostic — currently OpenAI, Gemini, Anthropic, Groq, and Mistral are supported. And there is a simple interface to implement support for other models.
* [Type-safe](https://ai.pydantic.dev/agents/#static-type-checking)
* Control flow and agent composition is done with vanilla Python, allowing you to make use of the same Python development best practices you'd use in any other (non-AI) project
* [Structured response](https://ai.pydantic.dev/results/#structured-result-validation) validation with Pydantic
Expand Down
3 changes: 3 additions & 0 deletions docs/api/models/mistral.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `pydantic_ai.models.mistral`

::: pydantic_ai.models.mistral
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PydanticAI is a Python Agent Framework designed to make it less painful to build
## Why use PydanticAI

* Built by the team behind Pydantic (the validation layer of the OpenAI SDK, the Anthropic SDK, LangChain, LlamaIndex, AutoGPT, Transformers, CrewAI, Instructor and many more)
* Model-agnostic — currently OpenAI, Gemini, Anthropic, and Groq are supported, and there is a simple interface to implement support for other models.
* Model-agnostic — currently OpenAI, Gemini, Anthropic, Groq, and Mistral are supported, and there is a simple interface to implement support for other models.
* [Type-safe](agents.md#static-type-checking)
* Control flow and agent composition is done with vanilla Python, allowing you to make use of the same Python development best practices you'd use in any other (non-AI) project
* [Structured response](results.md#structured-result-validation) validation with Pydantic
Expand Down
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ nav:
- api/exceptions.md
- api/settings.md
- api/models/base.md
- api/models/anthropic.md
- api/models/openai.md
- api/models/ollama.md
- api/models/anthropic.md
- api/models/gemini.md
- api/models/vertexai.md
- api/models/groq.md
- api/models/mistral.md
- api/models/ollama.md
- api/models/test.md
- api/models/function.md

Expand Down
10 changes: 10 additions & 0 deletions pydantic_ai_slim/pydantic_ai/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
'gemini-2.0-flash-exp',
'vertexai:gemini-1.5-flash',
'vertexai:gemini-1.5-pro',
# since mistral models are supported by other providers (e.g. ollama), and some of their models (e.g. "codestral")
# don't start with "mistral", we add the "mistral:" prefix to all to be explicit
'mistral:mistral-small-latest',
'mistral:mistral-large-latest',
'mistral:codestral-latest',
'mistral:mistral-moderation-latest',
'ollama:codellama',
'ollama:gemma',
'ollama:gemma2',
Expand Down Expand Up @@ -280,6 +286,10 @@ def infer_model(model: Model | KnownModelName) -> Model:
from .vertexai import VertexAIModel

return VertexAIModel(model[9:]) # pyright: ignore[reportArgumentType]
elif model.startswith('mistral:'):
from .mistral import MistralModel

return MistralModel(model[8:])
elif model.startswith('ollama:'):
from .ollama import OllamaModel

Expand Down
Loading
Loading