diff --git a/examples/quickstart_guided.py b/examples/quickstart_guided.py index ed20cac3..a9a57a5a 100644 --- a/examples/quickstart_guided.py +++ b/examples/quickstart_guided.py @@ -11,8 +11,8 @@ # 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") 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)