Core Infrastructure
The Core module provides shared infrastructure that powers all other modules in Django AI Core. It currently offers simple wrapper services for completion/embedding.
Future plans
By routing all AI requests through these core service we have a single place to start tracking any queries your app makes, supporting future planned features like:
- Request logging
- Cost calculations
- Rate limiting
LLM Service
Django AI Core provides an LLMService which can be used for requesting completions or embeddings from many AI providers.
It uses the any-llm package to provide a unified interface across multiple LLM providers including OpenAI, Anthropic, Gemini, Amazon Bedrock and self-hosted models through Ollama. See the full list of supported providers.
To use the LLMService:
from django_ai_core.llm import LLMService
service = LLMService.create(
provider="openai",
model="gpt-4o"
)
You can also alternatively instantiate LLMService with your own client instance:
from any_llm import AnyLLM
client = AnyLLM.create(
provider="openai",
model="gpt-4o"
)
service = LLMService(client=client)
Completions
Embeddings
All keyword arguments are passed to the underlying any-llm completion and embedding APIs.
any-llm normalises responses from all providers to OpenAI's API schema.