Spaces:
Runtime error
Runtime error
zenaight commited on
Commit ·
12b8eee
1
Parent(s): debdd9b
do it
Browse files- app/main.py +5 -7
app/main.py
CHANGED
|
@@ -146,10 +146,10 @@ def get_llm(model_name: str):
|
|
| 146 |
###############################################################################
|
| 147 |
|
| 148 |
@app.get("/suggestions", response_model=List[Dict[str, Any]])
|
| 149 |
-
async def get_suggestions() -> List[Dict[str, Any]]:
|
| 150 |
"""
|
| 151 |
For each fixed business question, generate three concise bullet-point suggestions.
|
| 152 |
-
This endpoint
|
| 153 |
"""
|
| 154 |
suggestions_list = []
|
| 155 |
|
|
@@ -162,11 +162,9 @@ async def get_suggestions() -> List[Dict[str, Any]]:
|
|
| 162 |
template=suggestion_template_str
|
| 163 |
)
|
| 164 |
|
| 165 |
-
#
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
prompt=suggestion_prompt
|
| 169 |
-
)
|
| 170 |
|
| 171 |
for question in QUESTIONS:
|
| 172 |
try:
|
|
|
|
| 146 |
###############################################################################
|
| 147 |
|
| 148 |
@app.get("/suggestions", response_model=List[Dict[str, Any]])
|
| 149 |
+
async def get_suggestions(model: str = "Mistral") -> List[Dict[str, Any]]:
|
| 150 |
"""
|
| 151 |
For each fixed business question, generate three concise bullet-point suggestions.
|
| 152 |
+
This endpoint can use various models via Hugging Face Inference API.
|
| 153 |
"""
|
| 154 |
suggestions_list = []
|
| 155 |
|
|
|
|
| 162 |
template=suggestion_template_str
|
| 163 |
)
|
| 164 |
|
| 165 |
+
# Get the appropriate LLM based on the selected model
|
| 166 |
+
llm = get_llm(model)
|
| 167 |
+
suggestion_chain = LLMChain(llm=llm, prompt=suggestion_prompt)
|
|
|
|
|
|
|
| 168 |
|
| 169 |
for question in QUESTIONS:
|
| 170 |
try:
|