mchabrol commited on
Commit
785d9af
·
verified ·
1 Parent(s): d6f7c78

model change

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -47,14 +47,18 @@ final_answer = FinalAnswerTool()
47
  #model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud' ,# it is possible that this model may be overloaded
48
  #custom_role_conversions=None,
49
  #)
 
50
  class DummyModel:
51
  def __init__(self):
52
  self.last_input_token_count = 0
53
  self.last_output_token_count = 0
54
 
55
- def __call__(self, prompt: str, **kwargs):
56
- self.last_input_token_count = len(prompt.split())
57
- self.last_output_token_count = 10 # juste une valeur arbitraire
 
 
 
58
 
59
  return {
60
  "text": """Thought: I now know the final answer.
 
47
  #model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud' ,# it is possible that this model may be overloaded
48
  #custom_role_conversions=None,
49
  #)
50
+
51
  class DummyModel:
52
  def __init__(self):
53
  self.last_input_token_count = 0
54
  self.last_output_token_count = 0
55
 
56
+ def __call__(self, prompt, **kwargs):
57
+ # prompt est une liste de messages [{"role": ..., "content": ...}, ...]
58
+ text_prompt = "\n".join([msg["content"] for msg in prompt if "content" in msg])
59
+
60
+ self.last_input_token_count = len(text_prompt.split())
61
+ self.last_output_token_count = 10 # valeur arbitraire
62
 
63
  return {
64
  "text": """Thought: I now know the final answer.