-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
114 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.contrib import admin | ||
from .models import LlmConfig | ||
|
||
@admin.register(LlmConfig) | ||
class LlmConfigAdmin(admin.ModelAdmin): | ||
list_display = ('llm_model', 'config_key', 'config_value', 'config_type', 'created_at', 'updated_at') | ||
search_fields = (['config_key', 'llm_model']) |
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,50 @@ | ||
[ | ||
{ | ||
"model": "labs.llmconfig", | ||
"pk": 1, | ||
"fields": { | ||
"llm_model": "llm_model", | ||
"config_key": "api_key", | ||
"config_value": "abcdef123456", | ||
"config_type": "string", | ||
"created_at": "2024-10-15T12:00:00Z", | ||
"updated_at": "2024-10-15T12:00:00Z" | ||
} | ||
}, | ||
{ | ||
"model": "labs.llmconfig", | ||
"pk": 2, | ||
"fields": { | ||
"llm_model": "llm_model", | ||
"config_key": "response_format", | ||
"config_value": "json", | ||
"config_type": "string", | ||
"created_at": "2024-10-15T12:00:00Z", | ||
"updated_at": "2024-10-15T12:00:00Z" | ||
} | ||
}, | ||
{ | ||
"model": "labs.llmconfig", | ||
"pk": 3, | ||
"fields": { | ||
"llm_model": "llm_model", | ||
"config_key": "endpoint", | ||
"config_value": "https://api.openai.com/v1/engines/davinci/completions", | ||
"config_type": "url", | ||
"created_at": "2024-10-15T12:00:00Z", | ||
"updated_at": "2024-10-15T12:00:00Z" | ||
} | ||
}, | ||
{ | ||
"model": "labs.llmconfig", | ||
"pk": 4, | ||
"fields": { | ||
"llm_model": "llm_model", | ||
"config_key": "max_tokens", | ||
"config_value": "4096", | ||
"config_type": "integer", | ||
"created_at": "2024-10-15T12:00:00Z", | ||
"updated_at": "2024-10-15T12:00:00Z" | ||
} | ||
} | ||
] |
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,42 @@ | ||
# Generated by Django 5.1.2 on 2024-10-16 15:57 | ||
|
||
import django.utils.timezone | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="LlmConfig", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("llm_model", models.TextField(blank=True, null=True)), | ||
("config_key", models.TextField(unique=True)), | ||
("config_value", models.TextField(blank=True, null=True)), | ||
("config_type", models.TextField(blank=True, null=True)), | ||
("created_at", models.DateTimeField(default=django.utils.timezone.now)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
], | ||
options={ | ||
"indexes": [ | ||
models.Index( | ||
fields=["config_key", "llm_model"], | ||
name="labs_llmcon_config__fda707_idx", | ||
) | ||
], | ||
}, | ||
), | ||
] |
Empty file.
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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
from django.db import models | ||
from django.utils import timezone | ||
|
||
class LLMSettings(models.Model): | ||
model_name = models.TextField() # Identifier for the LLM | ||
api_key = models.TextField() # API key for the LLM | ||
response_format = models.TextField() # Format of the response (e.g., JSON, text) | ||
endpoint = models.URLField() # API endpoint URL for the LLM | ||
extra_params = models.JSONField(blank=True, null=True) # Optional field for any extra parameters | ||
class LlmConfig(models.Model): | ||
llm_model = models.TextField(blank=True, null=True) | ||
config_key = models.TextField(unique=True) | ||
config_value = models.TextField(blank=True, null=True) | ||
config_type = models.TextField(blank=True, null=True) | ||
created_at = models.DateTimeField(default=timezone.now) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
|
||
def __str__(self): | ||
return self.model_name | ||
return f"{self.config_key}: {self.config_value}" | ||
|
||
class Meta: | ||
indexes = [ | ||
models.Index(fields=['config_key', 'llm_model']) | ||
] |
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