Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -697,22 +697,25 @@ class MovieKnowledgeBase:
|
|
697 |
movie_kb = MovieKnowledgeBase(movie_knowledge_base)
|
698 |
|
699 |
# Function tools with logging
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
def
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
|
|
|
|
|
|
716 |
|
717 |
def find_similar_movies(query_description, top_n=3):
|
718 |
"""
|
|
|
697 |
movie_kb = MovieKnowledgeBase(movie_knowledge_base)
|
698 |
|
699 |
# Function tools with logging
|
700 |
+
# Fix the decorator to properly handle the logger parameter
|
701 |
+
def log_function_tool(logger_param):
|
702 |
+
"""Decorator factory that returns a decorator to log function tool calls"""
|
703 |
+
def decorator(func):
|
704 |
+
@functools.wraps(func)
|
705 |
+
def wrapper(*args, **kwargs):
|
706 |
+
# Get function inputs
|
707 |
+
func_name = func.__name__
|
708 |
+
func_inputs = kwargs if kwargs else args[0] if args else {}
|
709 |
+
|
710 |
+
# Run the function
|
711 |
+
result = func(*args, **kwargs)
|
712 |
+
|
713 |
+
# Log function call
|
714 |
+
logger_param.log_function_call(func_name, func_inputs, result)
|
715 |
+
|
716 |
+
return result
|
717 |
+
return wrapper
|
718 |
+
return decorator
|
719 |
|
720 |
def find_similar_movies(query_description, top_n=3):
|
721 |
"""
|