Skip to content

Commit

Permalink
fix: litellm config issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tjbck committed Feb 25, 2024
1 parent 366679f commit d0c0d0d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ _old
uploads
.ipynb_checkpoints
*.db
_test
_test
!/data
/data/*
!/data/litellm
/data/litellm/*
!data/litellm/config.yaml

!data/config.json
36 changes: 36 additions & 0 deletions backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from pathlib import Path
import json
import yaml

import markdown
import requests
import shutil
Expand Down Expand Up @@ -163,6 +165,40 @@ def parse_section(section):
DOCS_DIR = f"{DATA_DIR}/docs"
Path(DOCS_DIR).mkdir(parents=True, exist_ok=True)


####################################
# LITELLM_CONFIG
####################################


def create_config_file(file_path):
directory = os.path.dirname(file_path)

# Check if directory exists, if not, create it
if not os.path.exists(directory):
os.makedirs(directory)

# Data to write into the YAML file
config_data = {
"general_settings": {},
"litellm_settings": {},
"model_list": [],
"router_settings": {},
}

# Write data to YAML file
with open(file_path, "w") as file:
yaml.dump(config_data, file)


LITELLM_CONFIG_PATH = f"{DATA_DIR}/litellm/config.yaml"

if not os.path.exists(LITELLM_CONFIG_PATH):
print("Config file doesn't exist. Creating...")
create_config_file(LITELLM_CONFIG_PATH)
print("Config file created successfully.")


####################################
# OLLAMA_API_BASE_URL
####################################
Expand Down

0 comments on commit d0c0d0d

Please sign in to comment.