Update app.py
Browse files271 unmodified lines27227327427527627727825 unmodified lines304305306307308309190 unmodified lines5005015025035045055063 unmodified lines510511512513514515516271 unmodified linesreturn final_responseclass SimpleDDGSearch:def search(self, query: str, num_results: int = 5):results = DDGS().text(query, region='wt-wt', safesearch='off', max_results=num_results)return [res["href"] for res in results]25 unmodified lines...,description="List of sources to cite. Should be an URL of the source.")def chatbot_interface(message, history, use_web_search, model, temperature, num_calls):if not message.strip():return "", history190 unmodified linesdef get_response_with_search(query, model, num_calls=3, temperature=0.2):searcher = SimpleDDGSearch()search_results = searcher.search(query, num_results=5)crawler = TrafilaturaWebCrawler()context = ""3 unmodified linesprompt = f"""Using the following context from web search results:{context}Write a detailed and complete research document that fulfills the following user request: '{query}'After writing the document, please provide a list of sources used in your response."""if model == "@cf/meta/llama-3.1-8b-instruct":271 unmodified lines27227327427527627727825 unmodified lines304305306307308309310190 unmodified lines5015025035045055065073 unmodified lines511512513514515516517271 unmodified linesreturn final_responseclass SimpleDDGSearch:def search(self, query: str, num_results: int = 10):results = DDGS().text(query, region='wt-wt', safesearch='off', max_results=num_results)return [res["href"] for res in results]25 unmodified lines...,description="List of sources to cite. Should be an URL of the source.")def chatbot_interface(message, history, use_web_search, model, temperature, num_calls):if not message.strip():return "", history190 unmodified linesdef get_response_with_search(query, model, num_calls=3, temperature=0.2):searcher = SimpleDDGSearch()search_results = searcher.search(query, num_results=10)crawler = TrafilaturaWebCrawler()context = ""3 unmodified linesprompt = f"""Using the following context from web search results:{context}Write a detailed and complete research article that fulfills the following user request: '{query}'After writing the document, please provide a list of sources used in your response."""if model == "@cf/meta/llama-3.1-8b-instruct":
app.py+4-3