-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support using Embeddings Model exposed via OpenAI (compatible) API (#…
…1051) This change adds the ability to use OpenAI, Azure OpenAI or any embedding model exposed behind an OpenAI compatible API (like Ollama, LiteLLM, vLLM etc.). Khoj previously only supported HuggingFace embedding models running locally on device or via HuggingFaceW inference API endpoint. This allows using commercial embedding models to index your content with Khoj.
- Loading branch information
Showing
6 changed files
with
127 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/khoj/database/migrations/0079_searchmodelconfig_embeddings_inference_endpoint_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 5.0.10 on 2025-01-08 15:09 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def set_endpoint_type(apps, schema_editor): | ||
SearchModelConfig = apps.get_model("database", "SearchModelConfig") | ||
SearchModelConfig.objects.filter(embeddings_inference_endpoint__isnull=False).exclude( | ||
embeddings_inference_endpoint="" | ||
).update(embeddings_inference_endpoint_type="huggingface") | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("database", "0078_khojuser_email_verification_code_expiry"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="searchmodelconfig", | ||
name="embeddings_inference_endpoint_type", | ||
field=models.CharField( | ||
choices=[("huggingface", "Huggingface"), ("openai", "Openai"), ("local", "Local")], | ||
default="local", | ||
max_length=200, | ||
), | ||
), | ||
migrations.RunPython(set_endpoint_type, reverse_code=migrations.RunPython.noop), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters