Spaces:
Sleeping
Sleeping
Commit
·
7c7b645
1
Parent(s):
a73952c
use hugging face if there is ollama_model is not set
Browse files
app.py
CHANGED
|
@@ -31,21 +31,19 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 31 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 32 |
|
| 33 |
def choose_model():
|
| 34 |
-
if os.getenv("
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
return HfApiModel(
|
| 37 |
max_tokens=2096,
|
| 38 |
temperature=0.5,
|
| 39 |
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 40 |
custom_role_conversions=None,
|
| 41 |
)
|
| 42 |
-
else:
|
| 43 |
-
print("Using Ollama")
|
| 44 |
-
return LiteLLMModel(
|
| 45 |
-
model_id=os.getenv("OLLAMA_MODEL"),
|
| 46 |
-
api_base=os.getenv("OLLAMA_ENDPOINT"),
|
| 47 |
-
api_key=os.getenv("OLLAMA_KEY"),
|
| 48 |
-
)
|
| 49 |
|
| 50 |
with open("prompts.yaml", "r") as stream:
|
| 51 |
prompt_templates = yaml.safe_load(stream)
|
|
|
|
| 31 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 32 |
|
| 33 |
def choose_model():
|
| 34 |
+
if os.getenv("OLLAMA_MODEL"):
|
| 35 |
+
return LiteLLMModel(
|
| 36 |
+
model_id=os.getenv("OLLAMA_MODEL"),
|
| 37 |
+
api_base=os.getenv("OLLAMA_ENDPOINT"),
|
| 38 |
+
api_key=os.getenv("OLLAMA_KEY"),
|
| 39 |
+
)
|
| 40 |
+
else:
|
| 41 |
return HfApiModel(
|
| 42 |
max_tokens=2096,
|
| 43 |
temperature=0.5,
|
| 44 |
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 45 |
custom_role_conversions=None,
|
| 46 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
with open("prompts.yaml", "r") as stream:
|
| 49 |
prompt_templates = yaml.safe_load(stream)
|