Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

TinyGraphRag

安装必要依赖:

pip install -r requirements.txt

配置使用的 LLM 和 Embedding 服务:

from tinygraph.graph import TinyGraph
from tinygraph.embedding.zhipu import zhipuEmb
from tinygraph.llm.zhipu import zhipuLLM
from tinygraph.ocr.Paddle import PaddleOCR
emb = zhipuEmb("model name", "your key")
llm = zhipuLLM("model name", "your key")
ocr = PaddleOCR()

graph = TinyGraph(
    url="your url",
    username="neo4j name",
    password="neo4j password",
    llm=llm,
    emb=emb,
    ocr=ocr
)

使用 TinyGraph 添加文档。目前支持所有文本格式的文件。这一步的时间可能较长,结束后,在当前目录下会生成一个 workspace 文件夹,包含 communitychunkdoc 信息:

graph.add_document("example/data.md")

完成文档添加后,可以使用 TinyGraph 进行查询。TinyGraph 支持本地查询和全局查询:

local_res = graph.local_query("what is ML")
print(local_res)
global_res = graph.global_query("what is ML")
print(global_res)

About

By developing it to study the RAG

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages