ai provider system

This commit is contained in:
vabene1111
2025-09-08 22:15:57 +02:00
parent 75fcff8e70
commit a7c5240227
53 changed files with 588 additions and 33 deletions

18
docs/features/ai.md Normal file
View File

@@ -0,0 +1,18 @@
Tandoor has several AI based features. To allow maximum flexibility, you can configure different AI providers and select them based on the task you want to perform.
To prevent accidental cost escalation Tandoor has a robust system of tracking and limiting AI costs.
## Default Configuration
By default the AI features are enabled for every space. Each space has a spending limit of roughly 1 USD per month.
This can be changed using the [configuration variables](https://docs.tandoor.dev/system/configuration/#ai-integration)
You can change these settings any time using the django admin. If you do not care about AI cost you can enter a very high limit or disable cost tracking for your providers.
The limit resets on the first of every month.
## Configure AI Providers
When AI support is enabled for a space every user in a space can configure AI providers.
The models shown in the editor have been tested and work with Tandoor. Most other models that can parse images/files and return text should also work.
Superusers also have the ability to configure global AI providers that every space can use.
## AI Log
The AI Log allows you to track the usage of AI calls. Here you can also see the usage.

View File

@@ -472,16 +472,16 @@ S3_CUSTOM_DOMAIN= # when using a CDN/proxy to S3 (see https://github.com/Tandoor
#### AI Integration
To use AI to perform different tasks you need to configure an API key and the AI provider. [LiteLLM](https://www.litellm.ai/) is used
to make a standardized request to different AI providers of your liking.
Configuring this via environment parameters is a temporary solution. In the future I plan on adding support for multiple AI providers per Tandoor instance
with the option to select them for various tasks. For now only gemini 2.0 flash has been tested but feel free to try out other models.
Most AI features are configured trough the AI Provider settings in the Tandoor web interface. Some defaults can be set for new spaces on your instance.
Enables AI features for spaces by default
```
AI_API_KEY=
AI_MODEL_NAME=gemini/gemini-2.0-flash
AI_RATELIMIT=60/hour
SPACE_AI_ENABLED=1
```
Sets the monthly default credit limit for AI usage
```
SPACE_AI_CREDITS_MONTHLY=100
```
#### FDC Api