mirror of
https://github.com/katanemo/plano.git
synced 2026-07-23 16:51:04 +02:00
removing model_server python module to brightstaff (function calling) (#615)
* adding function_calling functionality via rust * fixed rendered YAML file * removed model_server from envoy.template and forwarding traffic to bright_staff * fixed bugs in function_calling.rs that were breaking tests. All good now * updating e2e test to clean up disk usage * removing Arch* models to be used as a default model if one is not specified * if the user sets arch-function base_url we should honor it * fixing demos as we needed to pin to a particular version of huggingface_hub else the chatbot ui wouldn't build * adding a constant for Arch-Function model name * fixing some edge cases with calls made to Arch-Function * fixed JSON parsing issues in function_calling.rs * fixed bug where the raw response from Arch-Function was re-encoded * removed debug from supervisord.conf * commenting out disk cleanup * adding back disk space --------- Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-288.local> Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-342.local>
This commit is contained in:
parent
126b029345
commit
88c2bd1851
40 changed files with 2517 additions and 1356 deletions
|
|
@ -22,6 +22,28 @@ from common import (
|
|||
)
|
||||
|
||||
|
||||
def normalize_tool_call_arguments(tool_call):
|
||||
"""
|
||||
Normalize tool call arguments to ensure they are always a dict.
|
||||
|
||||
According to OpenAI API spec, the 'arguments' field should be a JSON string,
|
||||
but for easier testing we parse it into a dict here.
|
||||
|
||||
Args:
|
||||
tool_call: A tool call dict that may have 'arguments' as either a string or dict
|
||||
|
||||
Returns:
|
||||
A tool call dict with 'arguments' guaranteed to be a dict
|
||||
"""
|
||||
if "arguments" in tool_call and isinstance(tool_call["arguments"], str):
|
||||
try:
|
||||
tool_call["arguments"] = json.loads(tool_call["arguments"])
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
# If parsing fails, keep it as is
|
||||
pass
|
||||
return tool_call
|
||||
|
||||
|
||||
def test_prompt_gateway(httpserver: HTTPServer):
|
||||
simple_fixture = TEST_CASE_FIXTURES["SIMPLE"]
|
||||
input = simple_fixture["input"]
|
||||
|
|
@ -67,7 +89,7 @@ def test_prompt_gateway(httpserver: HTTPServer):
|
|||
tool_calls_message = arch_messages[0]
|
||||
tool_calls = tool_calls_message.get("tool_calls", [])
|
||||
assert len(tool_calls) > 0
|
||||
tool_call = tool_calls[0]["function"]
|
||||
tool_call = normalize_tool_call_arguments(tool_calls[0]["function"])
|
||||
diff = DeepDiff(tool_call, expected_tool_call, ignore_string_case=True)
|
||||
assert not diff
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue