OpenSPG / KAG

KAG is a logical form-guided reasoning and retrieval framework based on OpenSPG engine and LLMs. It is used to build logical reasoning and factual Q&A solutions for professional domain knowledge bases. It can effectively overcome the shortcomings of the traditional RAG vector similarity calculation model.
https://spg.openkg.cn/en-US
Apache License 2.0
623 stars 46 forks source link

openai.InternalServerError: Error code: 502 #38

Open zxy66688 opened 2 weeks ago

zxy66688 commented 2 weeks ago

Traceback (most recent call last): File "F:\openspg\KAG\kag\examples\musique\builder\indexer.py", line 89, in buildKB(corpusFilePath) File "F:\openspg\KAG\kag\examples\musique\builder\indexer.py", line 77, in buildKB MusiqueBuilderChain().invoke(file_path=corpusFilePath, max_workers=20) File "D:\anaconda3\envs\kag-demo\lib\site-packages\knext\builder\builder_chain_abc.py", line 26, in invoke chain.invoke(input=file_path, max_workers=max_workers, kwargs) File "D:\anaconda3\envs\kag-demo\lib\site-packages\knext\common\base\chain.py", line 64, in invoke node, result = future.result() File "D:\anaconda3\envs\kag-demo\lib\concurrent\futures_base.py", line 451, in result return self.get_result() File "D:\anaconda3\envs\kag-demo\lib\concurrent\futures_base.py", line 403, in get_result raise self._exception File "D:\anaconda3\envs\kag-demo\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) File "D:\anaconda3\envs\kag-demo\lib\site-packages\knext\common\base\chain.py", line 46, in execute_node ret = inner_future.result() File "D:\anaconda3\envs\kag-demo\lib\concurrent\futures_base.py", line 451, in result return self.get_result() File "D:\anaconda3\envs\kag-demo\lib\concurrent\futures_base.py", line 403, in get_result raise self._exception File "D:\anaconda3\envs\kag-demo\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(self.args, self.kwargs) File "f:\openspg\kag\kag\builder\component\vectorizer\batch_vectorizer.py", line 199, in invoke modified_input = self._generate_embedding_vectors(self.vectorizer, input) File "f:\openspg\kag\kag\builder\component\vectorizer\batch_vectorizer.py", line 188, in _generate_embedding_vectors generator.batch_generate(node_batch) File "f:\openspg\kag\kag\builder\component\vectorizer\batch_vectorizer.py", line 125, in batch_generate manager.batch_generate(self._vectorizer) File "f:\openspg\kag\kag\builder\component\vectorizer\batch_vectorizer.py", line 94, in batch_generate vectors = self._generate_vectors(vectorizer, text_batch) File "f:\openspg\kag\kag\builder\component\vectorizer\batch_vectorizer.py", line 84, in _generate_vectors vectors = vectorizer.vectorize(texts) File "f:\openspg\kag\kag\common\vectorizer\openai_vectorizer.py", line 57, in vectorize results = self.client.embeddings.create(input=texts, model=self.model) File "D:\anaconda3\envs\kag-demo\lib\site-packages\openai\resources\embeddings.py", line 124, in create return self._post( File "D:\anaconda3\envs\kag-demo\lib\site-packages\openai_base_client.py", line 1278, in post File "D:\anaconda3\envs\kag-demo\lib\site-packages\openai_base_client.py", line 955, in request return self._request( File "D:\anaconda3\envs\kag-demo\lib\site-packages\openai_base_client.py", line 1044, in _request return self._retry_request( File "D:\anaconda3\envs\kag-demo\lib\site-packages\openai_base_client.py", line 1093, in _retry_request return self._request( File "D:\anaconda3\envs\kag-demo\lib\site-packages\openai_base_client.py", line 1044, in _request return self._retry_request( File "D:\anaconda3\envs\kag-demo\lib\site-packages\openai_base_client.py", line 1093, in _retry_request return self._request( File "D:\anaconda3\envs\kag-demo\lib\site-packages\openai_base_client.py", line 1059, in _request raise self._make_status_error_from_response(err.response) from None openai.InternalServerError: Error code: 502

xionghuaidong commented 2 weeks ago

Please show you vectorizer config.

zxy66688 commented 2 weeks ago

Please show you vectorizer config.

vectorizer = kag.common.vectorizer.openAIVectorizer

xionghuaidong commented 2 weeks ago

Please show you vectorizer config.

vectorizer = kag.common.vectorizer.openAIVectorizer

The full content of the [vectorizer] section in kag_config.cfg please.

zxy66688 commented 2 weeks ago

Please show you vectorizer config.

vectorizer = kag.common.vectorizer.openAIVectorizer

The full content of the [vectorizer] section in kag_config.cfg please.

[vectorizer] vectorizer = kag.common.vectorizer.OpenAIVectorizer model = bge-m3 api_key = EMPTY base_url = http://127.0.0.1:11434/v1 vector_dimensions = 1024

xionghuaidong commented 1 week ago

[vectorizer] vectorizer = kag.common.vectorizer.OpenAIVectorizer model = bge-m3 api_key = EMPTY base_url = http://127.0.0.1:11434/v1 vector_dimensions = 1024

The ip address in base_url might be incorrect. You may need to change base_url to http://host.docker.internal:11434/v1. Please refere to 5. Configure KAG to use the bge-m3 model deployed with Ollama.

image

zxy66688 commented 1 week ago

[vectorizer] vectorizer = kag.common.vectorizer.OpenAIVectorizer model = bge-m3 api_key = EMPTY base_url = http://127.0.0.1:11434/v1 vector_dimensions = 1024

The ip address in base_url might be incorrect. You may need to change base_url to http://host.docker.internal:11434/v1. Please refere to 5. Configure KAG to use the bge-m3 model deployed with Ollama.

image

i have changed the base_url,but still have the same problem [vectorizer] vectorizer = kag.common.vectorizer.OpenAIVectorizer model = bge-m3 api_key = EMPTY base_url = http://host.docker.internal:11434/v1 vector_dimensions = 1024

caszkgui commented 1 week ago

[vectorizer] vectorizer = kag.common.vectorizer.OpenAIVectorizer model = bge-m3 api_key = EMPTY base_url = http://127.0.0.1:11434/v1 vector_dimensions = 1024

The ip address in base_url might be incorrect. You may need to change base_url to http://host.docker.internal:11434/v1. Please refere to 5. Configure KAG to use the bge-m3 model deployed with Ollama. image

i have changed the base_url,but still have the same problem [vectorizer] vectorizer = kag.common.vectorizer.OpenAIVectorizer model = bge-m3 api_key = EMPTY base_url = http://host.docker.internal:11434/v1 vector_dimensions = 1024

It seems like your embedding model is inaccessible in developer mode, please verify the configuration in the following order: 1、Have you deployed your embedding model with ollama(you can refer to embedding model with ollama) 2、Is your embedding model accessible by KAG ?(you can refer to Test embedding generation with bge-m3)