Pinecone向量查询无匹配结果问题求助
Pinecone向量查询无匹配结果问题求助
Hey 各位大佬,我最近碰到个头疼的问题想请大家帮忙看看!
我已经把Snowflake schema转换成向量并上传到Pinecone向量数据库了,但当我执行查询时,完全得不到任何匹配结果。
目前我已经确认的情况:
- 我能正常访问Pinecone数据库,调用
index.describe_index_stats()可以返回数据库的描述信息,说明连接是没问题的 - 我是照着官方的OpenAI相关指引来实现的,但就是查不到想要的结果
下面是我的代码:
from openai import OpenAI import pinecone client = OpenAI(api_key="my_API_key") pinecone_client = pinecone.Pinecone(api_key='api_key', environment='my_env') index = pinecone_client.Index('Index_name') query = "give me the list of clients" xq = client.embeddings.create(input=query, model=MODEL).data[0].embedding if pinecone_client.describe_index(index_name).status['ready']: res = index.query(vector=xq, top_k=1, include_metadata=True) else: print("server not ready") for match in res['matches']: print(f"{match['score']:.2f}: {match['metadata']['text']}")
按道理res里应该能返回和我的查询相关的匹配结果,但实际得到的res['matches']是空列表,完全没有数据返回。
有没有大佬能帮忙分析下可能的原因,或者给点排查方向呀?
备注:内容来源于stack exchange,提问作者Hanuman Rajagopal
相关产品推荐
相关产品推荐

