Skip to content

Commit a390336

Browse files
Documentation: add grids, tables to make intro info easier to digest (#276)
1 parent 56f9360 commit a390336

File tree

7 files changed

+100
-24
lines changed

7 files changed

+100
-24
lines changed

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,30 @@ We built PydanticAI with one simple aim: to bring that FastAPI feeling to GenAI
3333

3434
## Why use PydanticAI
3535

36-
* 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)
37-
* [Model-agnostic](https://ai.pydantic.dev/models/) — currently OpenAI, Anthropic, Gemini, Ollama, Groq, and Mistral are supported, and there is a simple interface to implement support for other models.
38-
* [Type-safe](https://ai.pydantic.dev/agents/#static-type-checking)
39-
* 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
40-
* [Structured response](https://ai.pydantic.dev/results/#structured-result-validation) validation with Pydantic
41-
* [Streamed responses](https://ai.pydantic.dev/results/#streamed-results), including validation of streamed _structured_ responses with Pydantic
42-
* Novel, type-safe [dependency injection system](https://ai.pydantic.dev/dependencies/), useful for testing and eval-driven iterative development
43-
* [Logfire integration](https://ai.pydantic.dev/logfire/) for debugging and monitoring the performance and general behavior of your LLM-powered application
36+
* __Built by the Pydantic Team__
37+
Built by the team behind [Pydantic](https://docs.pydantic.dev/latest/) (the validation layer of the OpenAI SDK, the Anthropic SDK, LangChain, LlamaIndex, AutoGPT, Transformers, CrewAI, Instructor and many more).
38+
39+
* __Model-agnostic__
40+
Supports OpenAI, Anthropic, Gemini, Ollama, Groq, and Mistral, and there is a simple interface to implement support for [other models](models.md).
41+
42+
* __Pydantic Logfire Integration__
43+
Seamlessly [integrates](logfire.md) with [Pydantic Logfire](https://pydantic.dev/logfire) for real-time debugging, performance monitoring, and behavior tracking of your LLM-powered applications.
44+
45+
* __Type-safe__
46+
Designed to make type checking as useful as possible for you, so it [integrates](agents.md#static-type-checking) well with static type checkers, like [`mypy`](https://github.com/python/mypy) and [`pyright`](https://github.com/microsoft/pyright).
47+
48+
* __Python-centric Design__
49+
Leverages Python’s familiar control flow and agent composition to build your AI-driven projects, making it easy to apply standard Python best practices you'd use in any other (non-AI) project
50+
51+
* __Structured Responses__
52+
Harnesses the power of [Pydantic](https://docs.pydantic.dev/latest/) to [validate and structure](results.md#structured-result-validation) model outputs, ensuring responses are consistent across runs.
53+
54+
* __Dependency Injection System__
55+
Offers an optional [dependency injection](dependencies.md) system to provide data and services to your agent's [system prompts](agents.md#system-prompts), [tools](tools.md) and [result validators](results.md#result-validators-functions).
56+
This is useful for testing and eval-driven iterative development.
57+
58+
* __Streamed Responses__
59+
Provides the ability to [stream](results.md#streamed-results) LLM outputs continuously, with immediate validation, ensuring rapid and accurate results.
4460

4561
## In Beta!
4662

docs/agents.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ but multiple agents can also interact to embody more complex workflows.
77

88
The [`Agent`][pydantic_ai.Agent] class has full API documentation, but conceptually you can think of an agent as a container for:
99

10-
* A [system prompt](#system-prompts) — a set of instructions for the LLM written by the developer
11-
* One or more [function tool](tools.md) — functions that the LLM may call to get information while generating a response
12-
* An optional structured [result type](results.md) — the structured datatype the LLM must return at the end of a run
13-
* A [dependency](dependencies.md) type constraint — system prompt functions, tools and result validators may all use dependencies when they're run
14-
* Agents may optionally also have a default [LLM model](api/models/base.md) associated with them; the model to use can also be specified when running the agent
10+
| **Component** | **Description** |
11+
|-------------------------------------------------|----------------------------------------------------------------------------------------------------------|
12+
| [System prompt(s)](#system-prompts) | A set of instructions for the LLM written by the developer. |
13+
| [Function tool(s)](tools.md) | Functions that the LLM may call to get information while generating a response. |
14+
| [Structured result type](results.md) | The structured datatype the LLM must return at the end of a run, if specified. |
15+
| [Dependency type constraint](dependencies.md) | System prompt functions, tools, and result validators may all use dependencies when they're run. |
16+
| [LLM model](api/models/base.md) | Optional default LLM model associated with the agent. Can also be specified when running the agent. |
17+
| [Model Settings](#additional-configuration) | Optional default model settings to help fine tune requests. Can also be specified when running the agent.|
1518

1619
In typing terms, agents are generic in their dependency and result types, e.g., an agent which required dependencies of type `#!python Foobar` and returned results of type `#!python list[str]` would have type `cAgent[Foobar, list[str]]`. In practice, you shouldn't need to care about this, it should just mean your IDE can tell you when you have the right type, and if you choose to use [static type checking](#static-type-checking) it should work well with PydanticAI.
1720

docs/extra/tweaks.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,34 @@ img.index-header {
1717
max-width: 500px;
1818
}
1919

20+
.pydantic-pink {
21+
color: #FF007F;
22+
}
23+
24+
.team-blue {
25+
color: #0072CE;
26+
}
27+
28+
.secure-green {
29+
color: #00A86B;
30+
}
31+
32+
.shapes-orange {
33+
color: #FF7F32;
34+
}
35+
36+
.puzzle-purple {
37+
color: #652D90;
38+
}
39+
40+
.wheel-gray {
41+
color: #6E6E6E;
42+
}
43+
44+
.vertical-middle {
45+
vertical-align: middle;
46+
}
47+
2048
.text-emphasis {
2149
font-size: 1rem;
2250
font-weight: 300;

docs/index.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,30 @@ We built PydanticAI with one simple aim: to bring that FastAPI feeling to GenAI
1313

1414
## Why use PydanticAI
1515

16-
* 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)
17-
* [Model-agnostic](models.md) — currently OpenAI, Anthropic, Gemini, Ollama, Groq, and Mistral are supported, and there is a simple interface to implement support for other models.
18-
* [Type-safe](agents.md#static-type-checking)
19-
* 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
20-
* [Structured response](results.md#structured-result-validation) validation with Pydantic
21-
* [Streamed responses](results.md#streamed-results), including validation of streamed _structured_ responses with Pydantic
22-
* Novel, type-safe [dependency injection system](dependencies.md), useful for testing and eval-driven iterative development
23-
* [Logfire integration](logfire.md) for debugging and monitoring the performance and general behavior of your LLM-powered application
16+
:material-account-group:{ .md .middle .team-blue }&nbsp;<strong class="vertical-middle">Built by the Pydantic Team</strong><br>
17+
Built by the team behind [Pydantic](https://docs.pydantic.dev/latest/) (the validation layer of the OpenAI SDK, the Anthropic SDK, LangChain, LlamaIndex, AutoGPT, Transformers, CrewAI, Instructor and many more).
18+
19+
:fontawesome-solid-shapes:{ .md .middle .shapes-orange }&nbsp;<strong class="vertical-middle">Model-agnostic</strong><br>
20+
Supports OpenAI, Anthropic, Gemini, Ollama, Groq, and Mistral, and there is a simple interface to implement support for [other models](models.md).
21+
22+
:logfire-logo:{ .md .middle }&nbsp;<strong class="vertical-middle">Pydantic Logfire Integration</strong><br>
23+
Seamlessly [integrates](logfire.md) with [Pydantic Logfire](https://pydantic.dev/logfire) for real-time debugging, performance monitoring, and behavior tracking of your LLM-powered applications.
24+
25+
:material-shield-check:{ .md .middle .secure-green }&nbsp;<strong class="vertical-middle">Type-safe</strong><br>
26+
Designed to make type checking as useful as possible for you, so it [integrates](agents.md#static-type-checking) well with static type checkers, like [`mypy`](https://github.com/python/mypy) and [`pyright`](https://github.com/microsoft/pyright).
27+
28+
:snake:{ .md .middle }&nbsp;<strong class="vertical-middle">Python-centric Design</strong><br>
29+
Leverages Python’s familiar control flow and agent composition to build your AI-driven projects, making it easy to apply standard Python best practices you'd use in any other (non-AI) project
30+
31+
:simple-pydantic:{ .md .middle .pydantic-pink }&nbsp;<strong class="vertical-middle">Structured Responses</strong><br>
32+
Harnesses the power of [Pydantic](https://docs.pydantic.dev/latest/) to [validate and structure](results.md#structured-result-validation) model outputs, ensuring responses are consistent across runs.
33+
34+
:material-puzzle-plus:{ .md .middle .puzzle-purple }&nbsp;<strong class="vertical-middle">Dependency Injection System</strong><br>
35+
Offers an optional [dependency injection](dependencies.md) system to provide data and services to your agent's [system prompts](agents.md#system-prompts), [tools](tools.md) and [result validators](results.md#result-validators-functions).
36+
This is useful for testing and eval-driven iterative development.
37+
38+
:material-sine-wave:{ .md .middle }&nbsp;<strong class="vertical-middle">Streamed Responses</strong><br>
39+
Provides the ability to [stream](results.md#streamed-results) LLM outputs continuously, with immediate validation, ensuring rapid and accurate results.
2440

2541
!!! example "In Beta"
2642
PydanticAI is in early beta, the API is still subject to change and there's a lot more to do.
@@ -45,12 +61,14 @@ The first known use of "hello, world" was in a 1974 textbook about the C program
4561
"""
4662
```
4763

48-
1. Define a very simple agent — here we configure the agent to use [Gemini 1.5's Flash](api/models/gemini.md) model, but you can also set the model when running the agent.
49-
2. Register a static [system prompt](agents.md#system-prompts) using a keyword argument to the agent. For more complex dynamically-generated system prompts, see the example below.
50-
3. [Run the agent](agents.md#running-agents) synchronously, conducting a conversation with the LLM. Here the exchange should be very short: PydanticAI will send the system prompt and the user query to the LLM, the model will return a text response.
64+
1. We configure the agent to use [Gemini 1.5's Flash](api/models/gemini.md) model, but you can also set the model when running the agent.
65+
2. Register a static [system prompt](agents.md#system-prompts) using a keyword argument to the agent.
66+
3. [Run the agent](agents.md#running-agents) synchronously, conducting a conversation with the LLM.
5167

5268
_(This example is complete, it can be run "as is")_
5369

70+
The exchange should be very short: PydanticAI will send the system prompt and the user query to the LLM, the model will return a text response.
71+
5472
Not very interesting yet, but we can easily add "tools", dynamic system prompts, and structured responses to build more powerful agents.
5573

5674
## Tools & Dependency Injection Example
Lines changed: 4 additions & 0 deletions
Loading

mkdocs.insiders.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ markdown_extensions:
2424
- pymdownx.emoji:
2525
emoji_index: !!python/name:material.extensions.emoji.twemoji
2626
emoji_generator: !!python/name:material.extensions.emoji.to_svg
27+
options:
28+
custom_icons:
29+
- docs/overrides/.icons
2730
- pymdownx.tabbed:
2831
alternate_style: true
2932
- pymdownx.tasklist:

mkdocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ extra:
5757

5858
theme:
5959
name: "material"
60+
custom_dir: docs/overrides
6061
palette:
6162
- media: "(prefers-color-scheme)"
6263
scheme: default
@@ -133,6 +134,9 @@ markdown_extensions:
133134
- pymdownx.emoji:
134135
emoji_index: !!python/name:material.extensions.emoji.twemoji
135136
emoji_generator: !!python/name:material.extensions.emoji.to_svg
137+
options:
138+
custom_icons:
139+
- docs/overrides/.icons
136140
- pymdownx.tabbed:
137141
alternate_style: true
138142
- pymdownx.tasklist:

0 commit comments

Comments
 (0)