Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -696,6 +696,24 @@ class MovieKnowledgeBase: 
     | 
|
| 696 | 
         
             
            # Initialize the knowledge base with embeddings
         
     | 
| 697 | 
         
             
            movie_kb = MovieKnowledgeBase(movie_knowledge_base)
         
     | 
| 698 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 699 | 
         
             
            def find_similar_movies(query_description, top_n=3):
         
     | 
| 700 | 
         
             
                """
         
     | 
| 701 | 
         
             
                Find movies similar to the query description using sentence embeddings and cosine similarity.
         
     | 
| 
         | 
|
| 696 | 
         
             
            # Initialize the knowledge base with embeddings
         
     | 
| 697 | 
         
             
            movie_kb = MovieKnowledgeBase(movie_knowledge_base)
         
     | 
| 698 | 
         | 
| 699 | 
         
            +
            # Function tools with logging
         
     | 
| 700 | 
         
            +
            def log_function_tool(func):
         
     | 
| 701 | 
         
            +
                """Decorator to log function tool calls"""
         
     | 
| 702 | 
         
            +
                @functools.wraps(func)
         
     | 
| 703 | 
         
            +
                def wrapper(*args, **kwargs):
         
     | 
| 704 | 
         
            +
                    # Get function inputs
         
     | 
| 705 | 
         
            +
                    func_name = func.__name__
         
     | 
| 706 | 
         
            +
                    func_inputs = kwargs if kwargs else args[0] if args else {}
         
     | 
| 707 | 
         
            +
                    
         
     | 
| 708 | 
         
            +
                    # Run the function
         
     | 
| 709 | 
         
            +
                    result = func(*args, **kwargs)
         
     | 
| 710 | 
         
            +
                    
         
     | 
| 711 | 
         
            +
                    # Log function call
         
     | 
| 712 | 
         
            +
                    logger.log_function_call(func_name, func_inputs, result)
         
     | 
| 713 | 
         
            +
                    
         
     | 
| 714 | 
         
            +
                    return result
         
     | 
| 715 | 
         
            +
                return wrapper
         
     | 
| 716 | 
         
            +
             
     | 
| 717 | 
         
             
            def find_similar_movies(query_description, top_n=3):
         
     | 
| 718 | 
         
             
                """
         
     | 
| 719 | 
         
             
                Find movies similar to the query description using sentence embeddings and cosine similarity.
         
     |