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

First issue #413

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions examples/quickstart_guided.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
11 changes: 10 additions & 1 deletion src/llm_vm/vector_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down