From 09c1921ab99c81db377a9c7b00bcfb157d007266 Mon Sep 17 00:00:00 2001 From: Saisri Vishwanath Date: Mon, 4 Dec 2023 00:58:26 -0500 Subject: [PATCH 1/3] Issue 393 --- examples/quickstart_guided.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/quickstart_guided.py b/examples/quickstart_guided.py index ed20cac3..a2ba0b14 100644 --- a/examples/quickstart_guided.py +++ b/examples/quickstart_guided.py @@ -11,10 +11,10 @@ # response = client.complete(prompt = 'Is 1+1=10000?', # context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False, regex=r"\s*([Yy]es|[Nn]o|[Nn]ever|[Aa]lways)") # print(response) -# response = client.complete(prompt = 'Did MJ win 6 titles with the Bulls', -# context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False,choices=["Hell yeah dude that's correct","No way, that's hella false"]) +response = client.complete(prompt = 'Did MJ win 6 titles with the Bulls', + context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False,choices=["Hell yeah dude that's correct","No way, that's hella false"]) # print(response) -response = client.complete(prompt = 'What does 1+1 equal?', - context='', openai_key=settings.openai_api_key, finetune = True, data_synthesis = True, type="integer") +#response = client.complete(prompt = 'What does 1+1 equal?', +# context='', openai_key=settings.openai_api_key, finetune = True, data_synthesis = True, type="integer") print(response) From 830516699eb0aff3275c964f52c73f41bda2d262 Mon Sep 17 00:00:00 2001 From: Saisri Vishwanath Date: Mon, 4 Dec 2023 01:01:09 -0500 Subject: [PATCH 2/3] adding comments --- examples/quickstart_guided.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/quickstart_guided.py b/examples/quickstart_guided.py index a2ba0b14..a9a57a5a 100644 --- a/examples/quickstart_guided.py +++ b/examples/quickstart_guided.py @@ -11,10 +11,10 @@ # response = client.complete(prompt = 'Is 1+1=10000?', # context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False, regex=r"\s*([Yy]es|[Nn]o|[Nn]ever|[Aa]lways)") # print(response) -response = client.complete(prompt = 'Did MJ win 6 titles with the Bulls', +#response = client.complete(prompt = 'Did MJ win 6 titles with the Bulls', context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False,choices=["Hell yeah dude that's correct","No way, that's hella false"]) # print(response) -#response = client.complete(prompt = 'What does 1+1 equal?', -# context='', openai_key=settings.openai_api_key, finetune = True, data_synthesis = True, type="integer") +response = client.complete(prompt = 'What does 1+1 equal?', + context='', openai_key=settings.openai_api_key, finetune = True, data_synthesis = True, type="integer") print(response) From cccdf5f2d512f11d204fec3c1340c928a8223b08 Mon Sep 17 00:00:00 2001 From: Saisri Vishwanath Date: Mon, 4 Dec 2023 01:04:36 -0500 Subject: [PATCH 3/3] adding comments --- src/llm_vm/vector_db.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/llm_vm/vector_db.py b/src/llm_vm/vector_db.py index 1e2ff0d9..73fb8fd2 100644 --- a/src/llm_vm/vector_db.py +++ b/src/llm_vm/vector_db.py @@ -31,7 +31,10 @@ def upsert(self, **kwargs): @abstractmethod def query(self, **kwargs): pass - + + @abstractmethod + def faiss_index(self, index_name): + pass class PineconeDB(VectorDB): def __init__(self, api_key, pinecone_env): @@ -61,6 +64,9 @@ def delete_index(self, index_name): self.pinecone.delete_index(index_name) print(f"${index_name} has been deleted") + def faiss_index(self, index_name): + return self.pinecone.add_faiss_index(index_name) + def upsert(self, **kwargs): if "vectors" not in kwargs: raise ValueError("Expected vectors as a keyword argument but found None") @@ -100,6 +106,9 @@ def describe_index(self, class_name): def delete_index(self, class_name): self.client.schema.delete_class(class_name) + + def faiss_index(self, class_name): + return self.client.schema.add_faiss_index(class_name) def upsert(self, class_name, batch_size=50, num_workers=1, dynamic=True, dataset=[]): self.client.batch.configure(batch_size=batch_size, num_workers=num_workers, dynamic=dynamic)