Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30560b5

Browse files
committed
Merge remote-tracking branch 'origin/main' into webcoderz/main
2 parents059f92e +28f8bde commit30560b5

File tree

146 files changed

+5239
-2695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+5239
-2695
lines changed

‎.github/workflows/ci.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
test-live:
9393
runs-on:ubuntu-latest
9494
timeout-minutes:5
95-
if:"github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'"
95+
if:github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
9696
steps:
9797
-uses:actions/checkout@v4
9898

@@ -275,7 +275,7 @@ jobs:
275275

276276
deploy-docs:
277277
needs:[check]
278-
if:"success() && startsWith(github.ref, 'refs/tags/')"
278+
if:success() && startsWith(github.ref, 'refs/tags/')
279279
runs-on:ubuntu-latest
280280
environment:
281281
name:deploy-docs
@@ -311,15 +311,22 @@ jobs:
311311
env:
312312
ALGOLIA_WRITE_API_KEY:${{ secrets.ALGOLIA_WRITE_API_KEY }}
313313

314+
# TODO(Marcelo): We need to split this into two jobs: `build` and `release`.
314315
release:
315316
needs:[check]
316-
if:"success() && startsWith(github.ref, 'refs/tags/')"
317+
if:success() && startsWith(github.ref, 'refs/tags/')
317318
runs-on:ubuntu-latest
318-
environment:release
319+
320+
environment:
321+
name:release
322+
url:https://pypi.org/project/pydantic-ai/${{ steps.inspect_package.outputs.version }}
319323

320324
permissions:
321325
id-token:write
322326

327+
outputs:
328+
package-version:${{ steps.inspect_package.outputs.version }}
329+
323330
steps:
324331
-uses:actions/checkout@v4
325332

@@ -329,7 +336,51 @@ jobs:
329336

330337
-run:uv build --all-packages
331338

339+
-name:Inspect package version
340+
id:inspect_package
341+
run:|
342+
version=$(uvx hatchling version)
343+
echo "version=$version" >> "$GITHUB_OUTPUT"
344+
332345
-name:Publish to PyPI
333346
uses:pypa/gh-action-pypi-publish@release/v1
334347
with:
335348
skip-existing:true
349+
350+
send-tweet:
351+
name:Send tweet
352+
needs:[release]
353+
if:needs.release.result == 'success'
354+
runs-on:ubuntu-latest
355+
356+
steps:
357+
-uses:actions/setup-python@v5
358+
with:
359+
python-version:'3.12'
360+
-name:Install dependencies
361+
run:pip install tweepy==4.14.0
362+
-name:Send tweet
363+
shell:python
364+
run:|
365+
import os
366+
import tweepy
367+
368+
client = tweepy.Client(
369+
access_token=os.getenv("TWITTER_ACCESS_TOKEN"),
370+
access_token_secret=os.getenv("TWITTER_ACCESS_TOKEN_SECRET"),
371+
consumer_key=os.getenv("TWITTER_CONSUMER_KEY"),
372+
consumer_secret=os.getenv("TWITTER_CONSUMER_SECRET"),
373+
)
374+
version = os.getenv("VERSION").strip('"')
375+
tweet = os.getenv("TWEET").format(version=version)
376+
client.create_tweet(text=tweet)
377+
env:
378+
VERSION:${{ needs.release.outputs.package-version }}
379+
TWEET:|
380+
PydanticAI version {version} is out! 🎉
381+
382+
https://github.com/pydantic/pydantic-ai/releases/tag/v{version}
383+
TWITTER_CONSUMER_KEY:${{ secrets.TWITTER_CONSUMER_KEY }}
384+
TWITTER_CONSUMER_SECRET:${{ secrets.TWITTER_CONSUMER_SECRET }}
385+
TWITTER_ACCESS_TOKEN:${{ secrets.TWITTER_ACCESS_TOKEN }}
386+
TWITTER_ACCESS_TOKEN_SECRET:${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

‎.hyperlint/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
reviewer:
2+
external_link_validation:
3+
ignore_url_keywords:["deno"]

‎README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ Designed to make [type checking](https://ai.pydantic.dev/agents/#static-type-che
4949
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.
5050

5151
*__Structured Responses__
52-
Harnesses the power of[Pydantic](https://docs.pydantic.dev/latest/) to[validate and structure](https://ai.pydantic.dev/results/#structured-result-validation) model outputs, ensuring responses are consistent across runs.
52+
Harnesses the power of[Pydantic](https://docs.pydantic.dev/latest/) to[validate and structure](https://ai.pydantic.dev/output/#structured-output) model outputs, ensuring responses are consistent across runs.
5353

5454
*__Dependency Injection System__
55-
Offers an optional[dependency injection](https://ai.pydantic.dev/dependencies/) system to provide data and services to your agent's[system prompts](https://ai.pydantic.dev/agents/#system-prompts),[tools](https://ai.pydantic.dev/tools/) and[result validators](https://ai.pydantic.dev/results/#result-validators-functions).
55+
Offers an optional[dependency injection](https://ai.pydantic.dev/dependencies/) system to provide data and services to your agent's[system prompts](https://ai.pydantic.dev/agents/#system-prompts),[tools](https://ai.pydantic.dev/tools/) and[output validators](https://ai.pydantic.dev/output/#output-validator-functions).
5656
This is useful for testing and eval-driven iterative development.
5757

5858
*__Streamed Responses__
59-
Provides the ability to[stream](https://ai.pydantic.dev/results/#streamed-results) LLM outputs continuously, with immediate validation, ensuring rapid and accurateresults.
59+
Provides the ability to[stream](https://ai.pydantic.dev/output/#streamed-results) LLM outputs continuously, with immediate validation, ensuring rapid and accurateoutputs.
6060

6161
*__Graph Support__
6262
[Pydantic Graph](https://ai.pydantic.dev/graph) provides a powerful way to define graphs using typing hints, this is useful in complex applications where standard control flow can degrade to spaghetti code.
@@ -80,7 +80,7 @@ agent = Agent(
8080
# Here the exchange should be very short: PydanticAI will send the system prompt and the user query to the LLM,
8181
# the model will return a text response. See below for a more complex run.
8282
result= agent.run_sync('Where does "hello world" come from?')
83-
print(result.data)
83+
print(result.output)
8484
"""
8585
The first known use of "hello, world" was in a 1974 textbook about the C programming language.
8686
"""
@@ -113,22 +113,22 @@ class SupportDependencies:
113113
db: DatabaseConn
114114

115115

116-
# This pydantic model defines the structure of theresult returned by the agent.
117-
classSupportResult(BaseModel):
116+
# This pydantic model defines the structure of theoutput returned by the agent.
117+
classSupportOutput(BaseModel):
118118
support_advice:str= Field(description='Advice returned to the customer')
119119
block_card:bool= Field(description="Whether to block the customer's card")
120120
risk:int= Field(description='Risk level of query',ge=0,le=10)
121121

122122

123123
# This agent will act as first-tier support in a bank.
124-
# Agents are generic in the type of dependencies they accept and the type ofresult they return.
125-
# In this case, the support agent has type `Agent[SupportDependencies,SupportResult]`.
124+
# Agents are generic in the type of dependencies they accept and the type ofoutput they return.
125+
# In this case, the support agent has type `Agent[SupportDependencies,SupportOutput]`.
126126
support_agent= Agent(
127127
'openai:gpt-4o',
128128
deps_type=SupportDependencies,
129-
# The response from the agent will, be guaranteed to be aSupportResult,
129+
# The response from the agent will, be guaranteed to be aSupportOutput,
130130
# if validation fails the agent is prompted to try again.
131-
result_type=SupportResult,
131+
output_type=SupportOutput,
132132
system_prompt=(
133133
'You are a support agent in our bank, give the'
134134
'customer support and judge the risk level of their query.'
@@ -150,7 +150,7 @@ async def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:
150150
# Pydantic is used to validate these arguments, and errors are passed back to the LLM so it can retry.
151151
@support_agent.tool
152152
asyncdefcustomer_balance(
153-
ctx: RunContext[SupportDependencies],include_pending:bool
153+
ctx: RunContext[SupportDependencies],include_pending:bool
154154
) ->float:
155155
"""Returns the customer's current account balance."""
156156
# The docstring of a tool is also passed to the LLM as the description of the tool.
@@ -168,17 +168,17 @@ async def customer_balance(
168168
asyncdefmain():
169169
deps= SupportDependencies(customer_id=123,db=DatabaseConn())
170170
# Run the agent asynchronously, conducting a conversation with the LLM until a final response is reached.
171-
# Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrievea result.
171+
# Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrievean output.
172172
result=await support_agent.run('What is my balance?',deps=deps)
173-
# The result will be validated with Pydantic to guarantee it is a `SupportResult`, since the agent is generic,
174-
# it'll also be typed as a `SupportResult` to aid with static type checking.
175-
print(result.data)
173+
# The`result.output` will be validated with Pydantic to guarantee it is a `SupportOutput`. Since the agent is generic,
174+
# it'll also be typed as a `SupportOutput` to aid with static type checking.
175+
print(result.output)
176176
"""
177177
support_advice='Hello John, your current account balance, including pending transactions, is $123.45.' block_card=False risk=1
178178
"""
179179

180180
result=await support_agent.run('I just lost my card!',deps=deps)
181-
print(result.data)
181+
print(result.output)
182182
"""
183183
support_advice="I'm sorry to hear that, John. We are temporarily blocking your card to prevent unauthorized transactions." block_card=True risk=8
184184
"""

‎docs-site/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default {
1919
constredirect_lookup:Record<string,string>={
2020
'/common_tools':'/common-tools/',
2121
'/testing-evals':'/testing/',
22+
'/result':'/output/',
2223
}
2324

2425
functionredirect(pathname:string):string|null{

‎docs/.hooks/build_llms_txt.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp