Update app.py
Browse files5 unmodified lines678991011124 unmodified lines171819202021222386 unmodified lines1101111121131131141151161171181191201211221231241251261271281291301311321331341351365 unmodified linesfrom datetime import datetime, timezonefrom pydantic import BaseModel, Fieldfrom trafilatura import fetch_url, extractfrom langchain import HuggingFaceHubfrom langchain_community.llms import HuggingFaceHub
from llama_cpp_agent import MessagesFormatterTypefrom llama_cpp_agent.chat_history import BasicChatHistory4 unmodified lines)from llama_cpp_agent.tools import WebSearchToolfrom llama_cpp_agent.prompt_templates import web_search_system_prompt, research_system_promptfrom langchain import HuggingFaceHubfrom langchain_community.llms import HuggingFaceHubfrom llama_cpp_agent.llm_output_settings import LlmStructuredOutputSettings, LlmStructuredOutputTypefrom llama_cpp_agent.llm_output_settings import LlmStructuredOutputType
86 unmodified lines
def get_provider_default_settings(self): return LlmStructuredOutputSettings( output_type=LlmStructuredOutputType.no_structured_output, # Changed to a valid option output_type=LlmStructuredOutputType.no_structured_output, include_system_prompt=False, include_user_prompt=False, include_assistant_prompt=False, )
def get_provider_identifier(self): return "HuggingFaceHub"
def __call__(self, *args, **kwargs): return self.model(*args, **kwargs)
# Add any other methods that might be required by WebSearchTool def get_num_tokens(self, text): # This is a placeholder. You might need to implement a proper token counting method return len(text.split())
def get_max_tokens(self): # This is a placeholder. Return the actual max tokens for your model return 2048
# Utility functionsdef get_server_time(): utc_time = datetime.now(timezone.utc)app.py+15-3