* feat(mcp): refactor tools to service layer and add database/table/field CRUD
Replace internal API request pattern with a dedicated service module for
MCP operations. Simplify tool architecture from dynamic per-table tools
to static tools with explicit table_id parameters. Add new tools for
managing databases, tables, fields, and batch row operations.
* fix(mcp): address Copilot review feedback
- Let exceptions propagate from MCPTool.call() so call_tool() logs them
- Fix N+1 queries in get_table_schema using enhance_field_queryset hook
- Fetch fields for all tables in a single specific_iterator pass
- Clamp list_rows pagination to safe bounds (ROW_PAGE_SIZE_LIMIT)
- Fix update_fields docstring to reflect type-change support
- Fix module path in utils.py comment
- Update "Adding a new tool" docs to match current MCPTool pattern
* fix: comment risky tools; waiting for a proper permission check
* feat(mcp): add enabled flag to MCPTool and disable risky tools
Add `enabled` attribute to MCPTool base class so tools can be registered
but hidden from MCP clients. Disable database/table/field CRUD tools
until users can control tool availability through the UI.
Also add docs/testing/mcp-test-plan.md with manual testing instructions.
* fix(mcp): replace list[dict] with typed Pydantic models for field/row specs
Validate required keys (name+type for field create, id for field update,
id for row update) at the schema level instead of relying on KeyError
from dict.pop() in the service layer.
Uses extra="allow" so type-specific options and field values pass through.
* fix: wrap update_rows in a transaction
* address feedback
* feat(assistant): add theme catalog, apply_theme, and theme templates
Add 20 new theme templates and theme infrastructure:
- THEME_CATALOG with 22 themes, ThemeName type, _load_theme_data(), apply_theme()
- BuilderItemCreate.theme field with auto-apply on creation
- set_theme() tool for changing themes on existing applications
- Unit tests and eval tests for theme functionality
* refactor(assistant): migrate theme evals to EvalChecklist pattern
Replace removed assert_no_tool_errors with EvalChecklist + count_tool_errors
in test_agent_creates_app_with_theme and test_agent_changes_theme. Remove
stale test_navigate_to_workspace test.
* refactor(assistant): move theme code from core/types to builder/themes
Theme catalog, apply_theme, and related helpers are a builder concern,
not core. Move them to tools/builder/themes.py so core never imports
from builder. Also make apply_theme return bool so set_theme can report
errors instead of silently claiming success, and fix "Thank youb" typo
across all 23 theme templates.
* refactor (AI field): remove langchain and use pydantic-ai (#5017)
* refactor(ai): replace langchain with pydantic-ai for LLM calls and structured output
Replace langchain dependency with pydantic-ai as the LLM abstraction
layer. Each GenerativeAIModelType now implements get_ai_model() returning
a pydantic-ai Model instance, and the base class provides prompt() and
prompt_structured() using Agent.run_sync().
- Remove langchain, langchain-openai, and direct openai/anthropic/mistralai
deps (pydantic-ai-slim extras install them)
- Add prompt_structured() with PromptedOutput for Pydantic model output
(e.g. BaserowFormulaModel)
- Add output_choices parameter to prompt() for constrained choice selection
with fuzzy matching, compatible with all models including those without
tool support
- Remove custom output_parsers.py (StrictEnumOutputParser, JsonOutputParser
replacements)
- Update AI field job flow to use prompt(output_choices=...) for choice
output and prompt_with_files fallback for file-based prompts
* refactor(ai): replace deprecated Assistants API with pydantic-ai multi-modal content
Replace OpenAI's deprecated Assistants API (file_search, threads, polling)
with pydantic-ai's native BinaryContent support. Files are now read from
storage and passed directly in the prompt as multi-modal content — no
upload/delete lifecycle needed.
- Add content parameter to prompt() for multi-modal file attachments
- Remove GenerativeAIWithFilesModelType abstract class and its upload/
delete/prompt_with_files methods
- Remove get_client() from BaseOpenAIGenerativeAIModelType (no longer
needed without file operations)
- Replace AIFileManager.upload_files_from_file_field() with
get_file_contents() returning BinaryContent objects
- Simplify job_types.py: file+choice paths merge into single prompt()
call with content and output_choices parameters
- Remove format_prompt/parse_output hooks (no longer needed)
- Remove FileId type alias and AIFileError exception
- Works with any provider that supports documents (OpenAI, Anthropic,
Mistral, Google) instead of only OpenAI
* refactor(ai): unify prompt API into single method with output_type parameter
Merge prompt_structured() into prompt() via the output_type parameter:
- None (default): plain text response
- list[str]: choice selection with fuzzy matching
- Pydantic BaseModel/TypedDict: structured output via PromptedOutput
Remove prompt_structured(), output_choices parameter, and dead code
(format_prompt, parse_output hooks, AIFileError, FileId type).
* refactor(ai): clean file handling API with model type owning processing logic
Redesign file handling so the model type owns all file processing decisions
(embed vs upload, size limits, count limits) while the manager only reads
metadata from storage and provides a lazy reader callback.
- Add supports_files flag and prepare_files() to GenerativeAIModelType base
- OpenAI implementation: embeds images inline (BinaryContent, 50MB/500 limit),
uploads documents (UploadedFile via Responses API)
- Use OpenAIResponsesModel instead of OpenAIChatModel for OpenAI provider
(supports all file types via input_file/input_image)
- AIFileManager.prepare_file_content() collects metadata, passes lazy
read_file callback — no data read until model type requests it
- Remove is_file_compatible/get_max_file_size from public API (moved into
prepare_files)
- Add type hints throughout
* fix(assistant): fix generate_formula tests and grid view row_height
- Add output_type param to TestGenerativeAIModelTypePromptError.prompt()
- Return BaserowFormulaModel in test mocks instead of raw JSON string
- Use correct ORM field name row_height_size in grid view from_django_orm
* docs: add AI field test plan
* refactor(ai): improve docstrings, fix prompt signature and empty prompt handling
* refactor(ai): merge ERROR_OUTPUT_PARSER into ERROR_GENERATIVE_AI_PROMPT
The distinction between output parsing errors and prompt errors didn't
provide actionable info to the user. Both now surface as a single
ERROR_GENERATIVE_AI_PROMPT error code.
* refactor(ai): move value generation into AIFieldHandler with AIFile abstraction
Introduce AIFile dataclass that wraps serialized UserFile dicts with
lazy read_content(). Move the core generation logic from
AIValueGenerator._generate_value_for into AIFieldHandler.generate_value_with_ai
so the handler owns the full flow: prompt resolution, file preparation,
AI call, file cleanup, and choice resolution.
- prepare_files() now takes list[AIFile] and returns only processed files
- cleanup_files() mirrors prepare_files() for provider file cleanup
- delete_file() takes AIFile instead of raw file_id string
- AIFieldEmptyPromptError raised when prompt resolves to empty
- Delete AIFileManager (absorbed into handler + model type)
* docs: add AI field architecture overview
* fix(ai): handle missing files and partial upload cleanup in prepare_files
- OpenAI prepare_files() now catches per-file errors (missing files,
upload failures) and skips them instead of failing the whole generation
- Handler cleanup uses ai_files instead of prepared so files uploaded
before a mid-prepare failure are still cleaned up
* fix(ai): normalize LLM responses before choice matching
Strip quotes, markdown bold, backticks, and trailing punctuation from
model responses before fuzzy matching. Use case-insensitive comparison
so responses like "POSITIVE" correctly match "Positive".
* address feedback
* Address feedback
* trixie and python 3.13
* Fix backend tests
* Fix various references to previous python 3.11
* Upgrade to python 3.14
* Use official version of caddy
* Update backend/Dockerfile
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix dev build
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* chore (AI-Assistant): add embeddings to docker-compose.dev.yml; improve installation docs
* Fix flaky test
* Address feedback
* Fix just dev down to stop all services
* create backend justfile; switch to uv
* Add deploy and dc-deploy recipes to build images
* Add uv.lock for reproducible builds
* CI fixes + improvements
* Reduce build time
* improve CI caching
* Improve exit early conditions
* Set requires_python==3.11.*; add backend/media to gitignore
* Fix all-in-one Dockerfiles and some other fixes
* Introduce frontend justfile + some other useful recipes
* Fix permissions issue with dev containers
* Improve dockerfiles and docs on how to use the dev env
* Fix mjml-email-compiler service
* Update docs + address feedback
* Fix containers healthchecks
* Fix yarn test in dev container
* Minor fixes to docs and justfile attach command
* Address Petr's feedback
* Address additional feedback
* Add changelog entry
* Address feedback: Petr and Przemek
* address feedback + prepare for saas PR
* minor fixes
* Address Bram's feedback 2
* Switch to udspy
* fix search tool and message history
* Added embeddings server docs
* Remove remaining litellm references
* bump udspy version to v0.1.6
* Added docs for setting up the AI-assistant
* fixed table
* port workflow formula generation tools to udspy
* Set a fake OPENAI_API_KEY for tests
* Fix flaky tests
---------
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
* Preparing for WA beta.
* Reintroducing Instance.compat_type to ensure that we still support our old node types for compat reasons.
* Revert the periodic type name.
* Post rebase linting
* Show the automation settings modal, but only show the General sidepanel in development.
* Fix e2e test