mirror of
https://github.com/fsecada01/Pygentic-AI.git
synced 2026-05-11 19:54:59 +00:00
fix: migrate OpenAIModel to provider API (pydantic-ai 0.4.x)
pydantic-ai 0.4.x removed the api_key kwarg from model constructors. Pass credentials via OpenAIProvider instead. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -6,6 +6,7 @@ import openai
|
||||
import praw
|
||||
from pydantic_ai import Agent
|
||||
from pydantic_ai.models.openai import OpenAIModel
|
||||
from pydantic_ai.providers.openai import OpenAIProvider
|
||||
|
||||
from backend.core.consts import AI_MODEL, default_system_prompt
|
||||
from backend.db.base import Base
|
||||
@ -70,7 +71,10 @@ class SwotAgentDeps:
|
||||
|
||||
|
||||
swot_agent = Agent(
|
||||
OpenAIModel(model_name=AI_MODEL, api_key=get_val("OPENAI_API_KEY")),
|
||||
OpenAIModel(
|
||||
model_name=AI_MODEL,
|
||||
provider=OpenAIProvider(api_key=get_val("OPENAI_API_KEY")),
|
||||
),
|
||||
deps_type=SwotAgentDeps,
|
||||
result_type=SwotAnalysis,
|
||||
system_prompt=default_system_prompt,
|
||||
|
||||
Reference in New Issue
Block a user