Commit 67cd9b76 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac: __user__ param

parent 8a86f327
...@@ -205,7 +205,6 @@ async def get_function_call_response(prompt, tool_id, template, task_model_id, u ...@@ -205,7 +205,6 @@ async def get_function_call_response(prompt, tool_id, template, task_model_id, u
# Parse the function response # Parse the function response
if content is not None: if content is not None:
print(content) print(content)
result = json.loads(content) result = json.loads(content)
print(result) print(result)
...@@ -223,13 +222,13 @@ async def get_function_call_response(prompt, tool_id, template, task_model_id, u ...@@ -223,13 +222,13 @@ async def get_function_call_response(prompt, tool_id, template, task_model_id, u
try: try:
# Get the signature of the function # Get the signature of the function
sig = inspect.signature(function) sig = inspect.signature(function)
# Check if 'user' is a parameter of the function # Check if '__user__' is a parameter of the function
if "user" in sig.parameters: if "__user__" in sig.parameters:
# Call the function with the 'user' parameter included # Call the function with the '__user__' parameter included
function_result = function( function_result = function(
**{ **{
**result["parameters"], **result["parameters"],
"user": { "__user__": {
"id": user.id, "id": user.id,
"name": user.name, "name": user.name,
"role": user.role, "role": user.role,
......
...@@ -57,7 +57,7 @@ def get_tools_specs(tools) -> List[dict]: ...@@ -57,7 +57,7 @@ def get_tools_specs(tools) -> List[dict]:
for param_name, param_annotation in get_type_hints( for param_name, param_annotation in get_type_hints(
function function
).items() ).items()
if param_name != "return" if param_name != "return" and param_name != "__user__"
}, },
"required": [ "required": [
name name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment