mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-04-29 12:00:00 +00:00
Initial commit with all features
This commit is contained in:
commit
bcd260a28b
52 changed files with 6897 additions and 0 deletions
24
open_notebook/graphs/tools.py
Normal file
24
open_notebook/graphs/tools.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from datetime import datetime
|
||||
|
||||
from langchain.tools import tool
|
||||
|
||||
|
||||
@tool
|
||||
def get_current_timestamp() -> str:
|
||||
"""
|
||||
Returns the current timestamp in the format YYYYMMDDHHmmss.
|
||||
"""
|
||||
return datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
|
||||
|
||||
@tool
|
||||
def ask_the_document(doc_id: str, question: str):
|
||||
"""
|
||||
Use this tool to ask a question to the document.
|
||||
Another LLM will ready the document and answer the question.
|
||||
Be specific and complete in your query given the LLM that will process it is very capable.
|
||||
"""
|
||||
from open_notebook.graphs.ask_content import graph
|
||||
|
||||
result = graph.invoke({"doc_id": doc_id, "question": question})
|
||||
return result["answer"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue