Skip to content

Conversation

@Light2Dark
Copy link
Contributor

@Light2Dark Light2Dark commented Jan 8, 2026

📝 Summary

Fixes #7428,
Fixes #6369,
Fixes #6228,
Fixes #7036.
Should fix #5340
Should fix #7040

Also supports other providers (non OpenAI compatible like Mistral), but they may require updating config.

I did not test with Azure, and my config is quite simple. Removes old chat_messages from types.

Todo:

  • support custom providers & custom models

OpenAI
image

image RIP $$

Deepseek
image

Mistral
image

inline completion
image

🔍 Description of Changes

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jan 9, 2026 9:12am

from marimo._server.models.completion import UIMessage as ServerUIMessage
from marimo._utils.http import HTTPStatus

TIMEOUT = 30
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed timeout because imo we can let users cancel their own requests

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates the remaining AI providers to use pydantic-ai, unifying the AI provider infrastructure and fixing several reported issues with provider compatibility. The migration simplifies the codebase by replacing custom provider implementations with pydantic-ai's standardized approach.

Key Changes:

  • Migrated OpenAI, Azure OpenAI, and custom providers to use pydantic-ai instead of direct SDK calls
  • Introduced a new CustomProvider class to handle OpenAI-compatible and other custom providers
  • Removed legacy provider abstractions like CompletionProvider and provider-specific conversion functions
  • Updated dependencies to include pydantic-ai with OpenAI support in the recommended and dev extras

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Updated dependencies to replace standalone openai>=1.55.3 with pydantic-ai-slim[openai]>=1.39.0 in recommended and dev extras
pixi.lock Updated lock file to reflect dependency changes with new SHA and editable flag
tests/_server/api/endpoints/test_ai.py Refactored tests to mock pydantic-ai provider methods instead of OpenAI SDK directly; simplified test structure
tests/_server/ai/test_providers.py Removed tests for legacy provider implementations; added tests for new provider capabilities (extended thinking, responses API support)
tests/_ai/test_chat_convert.py Removed tests for deprecated conversion functions that are now handled by pydantic-ai; updated ChatMessage initialization to use empty list for parts
marimo/_server/ai/providers.py Major refactor: introduced PydanticProvider base class, OpenAIClientMixin, and CustomProvider for flexible provider support; removed legacy CompletionProvider abstraction
marimo/_server/api/endpoints/ai.py Simplified endpoint handlers by removing provider type checks and using unified pydantic-ai interface
marimo/_ai/_convert.py Removed provider-specific tool conversion functions (OpenAI, Anthropic, Google) as pydantic-ai handles these internally

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Light2Dark Light2Dark marked this pull request as ready for review January 8, 2026 16:16
@Light2Dark Light2Dark requested a review from akshayka as a code owner January 8, 2026 16:16
mscolnick
mscolnick previously approved these changes Jan 8, 2026
@github-actions github-actions bot added the bash-focus Area to focus on during release bug bash label Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bash-focus Area to focus on during release bug bash bug Something isn't working internal A refactor or improvement that is not user facing

Projects

None yet

3 participants