Skip to content
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

Fix issue with the vector db when using pinecone #276

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/sherpa_ai/connectors/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ConversationStore(VectorStore):
def __init__(self, namespace, db, embeddings, text_key):
self.db = db
self.namespace = namespace
self.embeddings = embeddings
self.embeddings_func = embeddings
self.text_key = text_key

@classmethod
Expand All @@ -41,6 +41,11 @@ def add_text(self, text: str, metadata={}) -> str:

return id

@property
def embeddings(self) -> Optional[Embeddings]:
"""Access the query embedding object if available."""
return self.embeddings_func

def add_texts(self, texts: Iterable[str], metadatas: List[dict]) -> List[str]:
for text, metadata in zip(texts, metadatas):
self.add_text(text, metadata)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"input": [{"text": "You are a friendly assistent bot called Sherpa\\n\\n\\n\\nConstraints:\\n1. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.\\n2. You can seek for user assistance only by using the corresponding tool\\n3. Exclusively use the commands listed in double quotes e.g. \"command name\"\\n4. You must always choose a command unless you want to \"finish\"\\n\\nCommands:\\n1. Context Search: Access internal technical documentation for AI related projects, includingFixie, LangChain, GPT index, GPTCache, GPT4ALL, autoGPT, db-GPT, AgentGPT, sherpa.Only use this tool if you need information for these projects specifically., args json schema: {\"query\": {\"title\": \"Query\", \"type\": \"string\"}, \"need_meta\": {\"title\": \"Need Meta\", \"default\": false}}\\n2. finish: use this to signal that you have finished the current task, args: \"response\": \"final response to let people know you have finished the current task\"\\n\\nPerformance Evaluation:\\n1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\\n2. Constructively self-criticize your big-picture behavior constantly.\\n3. Reflect on past decisions and strategies to refine your approach.\\n4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.\\n\\nYou should only respond in JSON format as described below without any extra text.\\nResponse Format: \\n{\\n \"thoughts\": {\\n \"text\": \"thought\",\\n \"speak\": \"thoughts summary to say to user\"\\n },\\n \"command\": {\\n \"name\": \"tool/command name you choose\",\\n \"args\": {\\n \"arg name\": \"value\"\\n }\\n }\\n} \\nEnsure the response can be parsed by Python json.loads", "agent": "system"}, {"text": "The current time and date is Wed Jan 17 00:45:50 2024", "agent": "system"}, {"text": "Current task: What is langchain? \\n Determine which next command to use. Select the finish command if you and respond using the JSON format specified above without any extra text.\\n JSON Response: \\n", "agent": "human"}], "output": "{\\n \"thoughts\": {\\n \"text\": \"LangChain is a project related to AI. It is a decentralized blockchain-based platform that aims to provide language translation services using AI technology. It utilizes a network of nodes to process translation requests and rewards participants with cryptocurrency tokens. The goal of LangChain is to create a more efficient and cost-effective solution for language translation.\",\\n \"speak\": \"LangChain is a decentralized blockchain-based platform that provides language translation services using AI technology. It aims to create a more efficient and cost-effective solution for language translation.\"\\n },\\n \"command\": {\\n \"name\": \"finish\",\\n \"args\": {\\n \"response\": \"LangChain is a decentralized blockchain-based platform that provides language translation services using AI technology. It aims to create a more efficient and cost-effective solution for language translation.\"\\n }\\n }\\n}", "llm_name": "gpt-3.5-turbo"}
{"input": [{"text": "You are a friendly assistent bot called Sherpa\\n\\n\\n\\nConstraints:\\n1. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.\\n2. You can seek for user assistance only by using the corresponding tool\\n3. Exclusively use the commands listed in double quotes e.g. \"command name\"\\n4. You must always choose a command unless you want to \"finish\"\\n\\nCommands:\\n1. Context Search: Access internal technical documentation for AI related projects, includingFixie, LangChain, GPT index, GPTCache, GPT4ALL, autoGPT, db-GPT, AgentGPT, sherpa.Only use this tool if you need information for these projects specifically., args json schema: {\"query\": {\"title\": \"Query\", \"type\": \"string\"}, \"need_meta\": {\"title\": \"Need Meta\", \"default\": false}}\\n2. finish: use this to signal that you have finished the current task, args: \"response\": \"final response to let people know you have finished the current task\"\\n\\nPerformance Evaluation:\\n1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\\n2. Constructively self-criticize your big-picture behavior constantly.\\n3. Reflect on past decisions and strategies to refine your approach.\\n4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.\\n\\nYou should only respond in JSON format as described below without any extra text.\\nResponse Format: \\n{\\n \"thoughts\": {\\n \"text\": \"thought\",\\n \"speak\": \"thoughts summary to say to user\"\\n },\\n \"command\": {\\n \"name\": \"tool/command name you choose\",\\n \"args\": {\\n \"arg name\": \"value\"\\n }\\n }\\n} \\nEnsure the response can be parsed by Python json.loads", "agent": "system"}, {"text": "The current time and date is Wed Jan 17 00:45:54 2024", "agent": "system"}, {"text": "Assistant Reply: {\\n \"thoughts\": {\\n \"text\": \"LangChain is a project related to AI. It is a decentralized blockchain-based platform that aims to provide language translation services using AI technology. It utilizes a network of nodes to process translation requests and rewards participants with cryptocurrency tokens. The goal of LangChain is to create a more efficient and cost-effective solution for language translation.\",\\n \"speak\": \"LangChain is a decentralized blockchain-based platform that provides language translation services using AI technology. It aims to create a more efficient and cost-effective solution for language translation.\"\\n },\\n \"command\": {\\n \"name\": \"finish\",\\n \"args\": {\\n \"response\": \"LangChain is a decentralized blockchain-based platform that provides language translation services using AI technology. It aims to create a more efficient and cost-effective solution for language translation.\"\\n }\\n }\\n} \\nResult: Finished task. ", "agent": "human"}, {"text": "Current task: What is langchain? \\n Use the above information to respond to the user's message:\\nWhat is langchain?\\n\\nIf you use any resource, then create inline citation by addingthe DocID of the reference document at the end of the sentence in the format of 'Sentence [DocID]'\\nExample:\\nSentence1 [1]. Sentence2. Sentence3 [2].\\nOnly use the reference document. DO NOT use any links DO NOT include citation if the resource is notnecessary. only write text but not the JSON format specified above. \\nResult:", "agent": "human"}], "output": "LangChain is a decentralized blockchain-based platform that provides language translation services using AI technology. It aims to create a more efficient and cost-effective solution for language translation [1].", "llm_name": "gpt-3.5-turbo"}