-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
law_knowledge.insert_knowledge( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'insert_knowledge' #203
Comments
是不是我的数据库没有创建成功 |
能麻烦提供下更详细的情况吗,比如运行的代码、知识库和store的yaml配置文件等。 |
谢谢
这是我的数据库所在目录
这是我account_case_chroma_store.yaml
name: 'account_case_chroma_store'
description: '保存了证监会指出审计错误案例,以文本向量形式存储'
persist_path: '../../DB/A_1101_chroma_store.db'
embedding_model: 'dashscope_embedding'
similarity_top_k: 100
metadata:
type: 'STORE'
module: 'agentuniverse.agent.action.knowledge.store.chroma_store'
class: 'ChromaStore'
这是我account_case_sqlite_store.yaml
name: 'account_case_sqlite_store'
description: '保存了证监会指出审计错误,以文本形式存储'
db_path: '../../DB/account_case.sqlite3'
k1: 1.5
b: 0.75
keyword_extractor: 'jieba_keyword_extractor'
similarity_top_k: 10
metadata:
type: 'STORE'
module: 'agentuniverse.agent.action.knowledge.store.sqlite_store'
class: 'SQLiteStore'
这是我account_rule_knowledge.yaml
name: "account_case_knowledge"
description: "关于中国企业会计准则以及会计监督检查案例"
stores:
- "account_case_chroma_store"
- "account_case_sqlite_store"
query_paraphrasers:
- "custom_query_keyword_extractor"
insert_processors:
- "recursive_character_text_splitter"
rag_router: "nlu_rag_router"
post_processors:
- "dashscope_reranker"
readers:
pdf: "default_pdf_reader"
metadata:
type: 'KNOWLEDGE'
module: 'sample_standard_app.app.core.knowledge.account_rule_knowledge'
class: 'LawKnowledge'
这是py 文件
# !/usr/bin/env python3
# -*- coding:utf-8 -*-
from typing import List, Any
# @time : 2024/8/14 15:54
# @author : fanen.lhy
# @Email : ***@***.***
# @filename: law_knowledge.py
import json
from agentuniverse.agent.action.knowledge.knowledge import Knowledge
from agentuniverse.agent.action.knowledge.store.document import Document
class LawKnowledge(Knowledge):
def to_llm(self, retrieved_docs: List[Document]) -> Any:
retrieved_texts = [json.dumps({
"text": doc.text,
"from": doc.metadata["file_name"]
},ensure_ascii=False) for doc in retrieved_docs]
return '\n=========================================\n'.join(
retrieved_texts)
可是当我插入数据时
from agentuniverse.base.agentuniverse import AgentUniverse
from agentuniverse.agent.action.knowledge.knowledge_manager import KnowledgeManager
if __name__ == '__main__':
AgentUniverse().start(config_path='config/config.toml', core_mode=True)
civil_store_list = ["account_case_chroma_store", "account_case_sqlite_store"]
law_knowledge = KnowledgeManager().get_instance_obj("account_rule_knowledge")
law_knowledge.insert_knowledge(
source_path=r"D:\myvitual\app\resources\111p.pdf",
stores=civil_store_list
)
提示错误 AttributeError: 'NoneType' object has no attribute 'insert_knowledge
…------------------ 原始邮件 ------------------
发件人: "antgroup/agentUniverse" ***@***.***>;
发送时间: 2024年12月2日(星期一) 下午2:36
***@***.***>;
***@***.******@***.***>;
主题: Re: [antgroup/agentUniverse] law_knowledge.insert_knowledge( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'insert_knowledge' (Issue #203)
能麻烦提供下更详细的情况吗,比如运行的代码、知识库和store的yaml配置文件等。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
你的knowledge的name是account_case_knowledge,但是你get的是account_rule_knowledge。 KnowledgeManager().get_instance_obj("account_rule_knowledge") |
OK了,不过有个小 BUG
agentuniverse.agent.action.knowledge.knowledge:insert_knowledge:159 | Exception occurred in knowledge insert: Embedding dimension 1536 does not match collection dimensionality 384
这种错误 如何避免
…------------------ 原始邮件 ------------------
发件人: "antgroup/agentUniverse" ***@***.***>;
发送时间: 2024年12月2日(星期一) 下午5:21
***@***.***>;
***@***.******@***.***>;
主题: Re: [antgroup/agentUniverse] law_knowledge.insert_knowledge( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'insert_knowledge' (Issue #203)
你的knowledge的name是account_case_knowledge,但是你get的是account_rule_knowledge。
KnowledgeManager().get_instance_obj("account_rule_knowledge")
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
看上去像是chroma对应的数据库原本已经存了一个384维的向量,然后你现在配的dashscope生成的向量是1536维的所以存不进去。'../../DB/A_1101_chroma_store.db'确认下这个db是不是新创建的,不是的话可以删了重跑。chromadb的collection会在第一个向量插入后固定维度 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: