Skip to content

Migrate to PydanticAI for LLM and summary agents#59

Merged
wolfdancer merged 10 commits into
mainfrom
feature/issue-58-pydantic-ai-migration
Mar 24, 2026
Merged

Migrate to PydanticAI for LLM and summary agents#59
wolfdancer merged 10 commits into
mainfrom
feature/issue-58-pydantic-ai-migration

Conversation

@wolfdancer

Copy link
Copy Markdown
Owner

Summary

  • Replaces direct OpenAI SDK usage with PydanticAI Agent, enabling configurable LLM providers (OpenAI, Anthropic) via provider:model string format (e.g. "anthropic:claude-sonnet-4-6")
  • Renames openai_api_keyembeddings_api_key, adds explicit llm_api_key and llm_model config fields so embeddings and chat LLM can be configured independently
  • Adds structured SummaryOutput Pydantic model for knowledge manager summaries, with summary, key_points, and suggested_title fields
  • Adds tests/test_conversation_engine.py and tests/test_knowledge_manager.py using PydanticAI's TestModel for fast, dependency-free testing

Test plan

  • pytest passes all tests including new async tests for ConversationEngine and KnowledgeManager
  • Bot runs end-to-end with OpenAI config (llm_model: "openai:gpt-4o")
  • Bot runs end-to-end with Anthropic config (llm_model: "anthropic:claude-sonnet-4-6")
  • Existing config.yaml updated to new field names (embeddings_api_key, llm_api_key, llm_model)

Closes #58

wolfdancer and others added 10 commits March 22, 2026 19:14
Replaces direct OpenAI SDK usage with PydanticAI Agent, enabling
configurable LLM providers (OpenAI, Anthropic) via a provider:model
string format. Renames openai_api_key → embeddings_api_key, adds
explicit llm_api_key and llm_model config fields. Adds structured
SummaryOutput type and tests for ConversationEngine and KnowledgeManager.

Closes #58
- Install requirements-dev.txt to get pytest-asyncio
- Explicitly install pydantic-ai>=1.0.0 with -U to upgrade opentelemetry
  packages past the version pinned by chromadb
Missing '; python_version >= "3.13"' marker caused CI failure on Python 3.10.
chromadb pins opentelemetry-exporter-otlp-proto-common==1.32.0 which
lacks _create_exp_backoff_generator required by pydantic-ai.
…r otel packages

grpc 1.32.0 imports _create_exp_backoff_generator from proto-common but that
function only exists in newer versions. Must upgrade all otel packages together.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lemetry

Pin pydantic-ai>=1.0.0 in requirements.in and recompile both requirements
files so opentelemetry packages are consistently at 1.39.1 — compatible with
both chromadb and pydantic-ai/logfire. Removes the version-upgrade workaround
from the CI workflow.
numpy 2.4.x and other dependencies require Python >=3.11.
langchain 1.x removed langchain.vectorstores.base, langchain.embeddings.base,
and langchain.text_splitter — updating those imports is a separate task.
Bump requires-python to >=3.13 to match dev/CI environment. Populate
dependencies to mirror requirements.in so pip install -e . works correctly.
@wolfdancer wolfdancer merged commit 23b6599 into main Mar 24, 2026
1 check passed
@wolfdancer wolfdancer deleted the feature/issue-58-pydantic-ai-migration branch March 24, 2026 05:22
wolfdancer added a commit that referenced this pull request Jun 17, 2026
Reconcile the Slack bot with the PydanticAI migration (#59):
- SlackBotConfig: replace openai_api_key with embeddings_api_key / llm_api_key
  / llm_model, matching DiscordBotConfig (read by Innie/Topic).
- slack_bot.py: Innie() now takes only outie_config (no api_key arg).
- Add slack-bolt to pyproject dependencies (was only in requirements).
- Update slack_config.example.yaml and Slack tests for the new fields.
- Reconcile CLAUDE.md to cover both platforms and the PydanticAI engine.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate InnieMe to PydanticAI (Full Integration)

1 participant