Fix the issue of Arch-Intent

This commit is contained in:
Shuguang Chen 2024-12-06 11:53:46 -08:00
parent 4fcfd83639
commit 818ec0a9db
4 changed files with 7 additions and 9 deletions

View file

@ -24,11 +24,7 @@ Provide your tool assessment for ONLY THE LAST USER MESSAGE in the above convers
ARCH_INTENT_GENERATION_CONFIG = {
"generation_params": {
"stop_token_ids": [151645],
"max_tokens": 1,
"guided_choice": ["Yes", "No"],
}
"generation_params": {"max_tokens": 1, "stop_token_ids": [151645]}
}

View file

@ -28,8 +28,8 @@ class ChatCompletionResponse(BaseModel):
id: Optional[int] = 0
object: Optional[str] = "chat_completion"
created: Optional[str] = ""
model: str
choices: List[Choice]
model: str
class ArchBaseHandler:
@ -124,7 +124,7 @@ class ArchBaseHandler:
if tools:
processed_messages.append(
{"role": "system", "content": self._format_system(tools)}
{"role": "system", "content": self._format_system_prompt(tools)}
)
for message in messages:

View file

@ -108,7 +108,9 @@ class ArchIntentHandler(ArchBaseHandler):
extra_body=self.generation_params,
)
model_response = Message(content=model_response, tool_calls=[])
model_response = Message(
content=model_response.choices[0].message.content, tool_calls=[]
)
chat_completion_response = ChatCompletionResponse(
choices=[Choice(message=model_response)], model=self.model_name

View file

@ -86,7 +86,7 @@ async def test_chat_completion(mock_hanlder, mock_client):
mock_client.chat.completions.create.return_value = mock_response
# Mock the tool formatter
mock_hanlder._format_system.return_value = "<formatted_tools>"
mock_hanlder._format_system_prompt.return_value = "<formatted_tools>"
response = Response()
chat_response = await chat_completion(request, response)