Make search model configurable on server

- Expose ability to modify search model via Django admin interface
- Previously the bi_encoder and cross_encoder models to use were set
  in code
- Now it's user configurable but with a default config generated by
  default
This commit is contained in:
Debanjum Singh Solanky
2023-11-14 16:56:26 -08:00
parent b734984d6d
commit 4af194d74b
10 changed files with 91 additions and 28 deletions

View File

@@ -102,6 +102,18 @@ class LocalPlaintextConfig(BaseModel):
user = models.ForeignKey(KhojUser, on_delete=models.CASCADE)
class SearchModel(BaseModel):
class ModelType(models.TextChoices):
TEXT = "text"
name = models.CharField(max_length=200, default="default")
model_type = models.CharField(max_length=200, choices=ModelType.choices, default=ModelType.TEXT)
bi_encoder = models.CharField(max_length=200, default="thenlper/gte-small")
cross_encoder = models.CharField(
max_length=200, default="cross-encoder/ms-marco-MiniLM-L-6-v2", null=True, blank=True
)
class OpenAIProcessorConversationConfig(BaseModel):
api_key = models.CharField(max_length=200)