zenaight commited on
Commit
12b8eee
·
1 Parent(s): debdd9b
Files changed (1) hide show
  1. 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 uses gpt-4o-mini-2024-07-18 via LangChain.
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
- # Use ChatOpenAI (gpt-4o-mini-2024-07-18) to generate suggestions.
166
- suggestion_chain = LLMChain(
167
- llm=ChatOpenAI(model_name="gpt-4o-mini-2024-07-18", temperature=0.7),
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: