-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,43 @@ | ||
from apps.handle.chat.api_rpc import chat | ||
from apps.handle.chat.api_rpc import chat, model_message | ||
from apps.handle.knowledge.knowledge_utils import load_knowledge | ||
from apps.handle.retrieval.retrieval_utils import Search | ||
from apps.handle.mylang.chain_utils import llm | ||
from langchain.tools.retriever import create_retriever_tool | ||
from langchain.tools.render import format_tool_to_openai_function | ||
from langgraph.prebuilt import ToolExecutor | ||
from langchain.chat_models import ChatBaichuan | ||
from apps.handle.mylang.chain_utils import CustomChat | ||
import os | ||
from langchain_core.messages import ( | ||
AIMessage, | ||
AIMessageChunk, | ||
BaseMessage, | ||
BaseMessageChunk, | ||
ChatMessage, | ||
ChatMessageChunk, | ||
HumanMessage, | ||
HumanMessageChunk, | ||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
for i, _ in chat('达美康的国内适应症是什么?缓释制剂初始剂量是多少?', is_stream=True): | ||
print(i) | ||
db = load_knowledge('test') | ||
search = Search(db) | ||
|
||
from apps.handle.mylang.agent_utils import AgenticRAG | ||
|
||
rag = AgenticRAG(search) | ||
|
||
inputs = { | ||
"messages": [ | ||
HumanMessage( | ||
content="What does Lilian Weng say about the types of agent memory?" | ||
) | ||
] | ||
} | ||
for output in rag(inputs): | ||
for key, value in output.items(): | ||
print(f"Output from node '{key}':") | ||
print("---") | ||
print(value) | ||
print("\n---\n") |