Rename OpenAIProcessorConversationConfig DB model to more apt AiModelApi (#998)

* Rename OpenAIProcessorConversationConfig to more apt AiModelAPI

The DB model name had drifted from what it is being used for,
a general chat api provider that supports other chat api providers like
anthropic and google chat models apart from openai based chat models.

This change renames the DB model and updates the docs to remove this
confusion.

Using Ai Model Api we catch most use-cases including chat, stt, image generation etc.
This commit is contained in:
Debanjum
2024-12-08 18:02:29 -08:00
committed by GitHub
parent df66fb23ab
commit 9dd3782f5c
18 changed files with 108 additions and 105 deletions

View File

@@ -34,8 +34,8 @@ from khoj.utils.constants import web_directory
from khoj.utils.helpers import resolve_absolute_path
from khoj.utils.rawconfig import ContentConfig, ImageSearchConfig, SearchConfig
from tests.helpers import (
AiModelApiFactory,
ChatModelOptionsFactory,
OpenAIProcessorConversationConfigFactory,
ProcessLockFactory,
SubscriptionFactory,
UserConversationProcessorConfigFactory,
@@ -319,9 +319,7 @@ def chat_client_builder(search_config, user, index_content=True, require_auth=Fa
elif chat_provider == ChatModelOptions.ModelType.ANTHROPIC:
online_chat_model = ChatModelOptionsFactory(chat_model="claude-3-5-haiku-20241022", model_type="anthropic")
if online_chat_model:
online_chat_model.openai_config = OpenAIProcessorConversationConfigFactory(
api_key=get_chat_api_key(chat_provider)
)
online_chat_model.ai_model_api = AiModelApiFactory(api_key=get_chat_api_key(chat_provider))
UserConversationProcessorConfigFactory(user=user, setting=online_chat_model)
state.anonymous_mode = not require_auth