GenAICoder commited on
Commit
e69152e
·
verified ·
1 Parent(s): 4b8d131

Update analytics/ai_assistant.py

Browse files
Files changed (1) hide show
  1. analytics/ai_assistant.py +8 -6
analytics/ai_assistant.py CHANGED
@@ -126,7 +126,7 @@ def _get_inference_client():
126
  "HUGGINGFACE_API_TOKEN is required for AI assistant. "
127
  "Set it in your environment before running the app."
128
  )
129
- return InferenceClient(model=HF_MODEL_ID, token=HF_TOKEN)
130
 
131
 
132
  def generate_ai_answer(question: str, df: pd.DataFrame, as_of_month: str = None, segment: str = None):
@@ -141,11 +141,13 @@ def generate_ai_answer(question: str, df: pd.DataFrame, as_of_month: str = None,
141
  )
142
 
143
  client = _get_inference_client()
144
- response = client.text_generation(prompt, parameters={
145
- "max_new_tokens": HF_MAX_TOKENS,
146
- "temperature": HF_TEMPERATURE,
147
- "top_k": 50,
148
- "top_p": 0.95,
 
 
149
  })
150
 
151
  if isinstance(response, dict):
 
126
  "HUGGINGFACE_API_TOKEN is required for AI assistant. "
127
  "Set it in your environment before running the app."
128
  )
129
+ return InferenceClient(token=HF_TOKEN)
130
 
131
 
132
  def generate_ai_answer(question: str, df: pd.DataFrame, as_of_month: str = None, segment: str = None):
 
141
  )
142
 
143
  client = _get_inference_client()
144
+ response = client.text_generation(
145
+ model=HF_MODEL_ID,
146
+ prompt,
147
+ max_new_tokens= HF_MAX_TOKENS,
148
+ temperature= HF_TEMPERATURE,
149
+ top_k= 50,
150
+ top_p= 0.95,
151
  })
152
 
153
  if isinstance(response, dict):