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

HandleNonecreated timestamp coming from OpenRouter API#2247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
R0boji wants to merge1 commit intopydantic:main
base:main
Choose a base branch
Loading
fromR0boji:main
Open
Changes fromall commits
Commits
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
7 changes: 5 additions & 2 deletionspydantic_ai_slim/pydantic_ai/models/openai.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,7 @@

from .. import ModelHTTPError, UnexpectedModelBehavior, _utils, usage
from .._output import DEFAULT_OUTPUT_TOOL_NAME, OutputObjectDefinition
from .._utils import guard_tool_call_id as _guard_tool_call_id, number_to_datetime
from .._utils import guard_tool_call_id as _guard_tool_call_id, number_to_datetime, now_utc as _now_utc
from ..messages import (
AudioUrl,
BinaryContent,
Expand DownExpand Up@@ -349,7 +349,10 @@ async def _completions_create(

def _process_response(self, response: chat.ChatCompletion) -> ModelResponse:
"""Process a non-streamed response, and prepare a message to return."""
timestamp = number_to_datetime(response.created)
if response.created:
timestamp = number_to_datetime(response.created)
else:
timestamp = _now_utc()
choice = response.choices[0]
items: list[ModelResponsePart] = []
# The `reasoning_content` is only present in DeepSeek models.
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp