Skip to content

Commit

Permalink
Merge pull request StarlightSearch#76 from akshayballal95/main
Browse files Browse the repository at this point in the history
add analytics

Former-commit-id: b8fcf6f9027d6aec18326e9e6278e62efe551136 [formerly 466f97cf66cf2fc3b7eeac3aa4bb6a56e75ed6cc] [formerly 87df700 [formerly dd33ae5]]
Former-commit-id: 87df700
Former-commit-id: e0bab860a61b9a0f7c8fd7e250c4e6d2b795dc1d
  • Loading branch information
akshayballal95 authored Sep 13, 2024
2 parents 559bba0 + fdbfab9 commit 8dc4d65
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 125 deletions.
9 changes: 0 additions & 9 deletions docs/blog.md

This file was deleted.

21 changes: 20 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,23 @@ markdown_extensions:
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.superfences

extra:
analytics:
provider: google
property: G-25WL8Y1K9Y
feedback:
title: Was this page helpful?
ratings:
- icon: material/emoticon-happy-outline
name: This page was helpful
data: 1
note: >-
Thanks for your feedback!
- icon: material/emoticon-sad-outline
name: This page could be improved
data: 0
note: >-
Thanks for your feedback! Help us improve this page by
using our <a href="..." target="_blank" rel="noopener">feedback form</a>.
117 changes: 2 additions & 115 deletions python/python/embed_anything/vectordb.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,124 +19,11 @@ def delete_index(self, index_name: str):
pass

@abstractmethod
def convert(self, embeddings: List[List[EmbedData]]) -> List[Dict]:
def convert(self, embeddings: List[EmbedData]) -> List[Dict]:
pass

@abstractmethod
def upsert(self, data: List[Dict]):
data = self.convert(data)
pass


# class PineconeAdapter(Adapter):
# """
# Adapter class for interacting with Pinecone, a vector database service.
# """

# def __init__(self, api_key: str):
# """
# Initializes a new instance of the PineconeAdapter class.

# Args:
# api_key (str): The API key for accessing the Pinecone service.
# """
# super().__init__(api_key)
# self.pc = Pinecone(api_key=self.api_key)
# self.index_name = None

# def create_index(
# self,
# dimension: int,
# metric: str = "cosine",
# index_name: str = "anything",
# spec=ServerlessSpec(cloud="aws", region="us-east-1"),
# ):
# """
# Creates a new index in Pinecone.

# Args:
# dimension (int): The dimensionality of the embeddings.
# metric (str, optional): The distance metric to use for similarity search. Defaults to "cosine".
# index_name (str, optional): The name of the index. Defaults to "anything".
# spec (ServerlessSpec, optional): The serverless specification for the index. Defaults to AWS in us-east-1 region.
# """
# self.index_name = index_name
# self.pc.create_index(
# name=index_name, dimension=dimension, metric=metric, spec=spec
# )

# def delete_index(self, index_name: str):
# """
# Deletes an existing index from Pinecone.

# Args:
# index_name (str): The name of the index to delete.
# """
# self.pc.delete_index(name=index_name)

# def convert(self, embeddings: List[EmbedData]) -> List[Dict]:
# """
# Converts a list of embeddings into the required format for upserting into Pinecone.

# Args:
# embeddings (List[EmbedData]): The list of embeddings to convert.

# Returns:
# List[Dict]: The converted data in the required format for upserting into Pinecone.
# """
# data_emb = []

# for embedding in embeddings:
# data_emb.append(
# {
# "id": str(uuid.uuid4()),
# "values": embedding.embedding,
# "metadata": {
# "text": embedding.text,
# "file": re.split(
# r"/|\\", embedding.metadata.get("file_name", "")
# )[-1],
# },
# }
# )
# return data_emb

# def upsert(self, data: List[Dict]):
# """
# Upserts data into the specified index in Pinecone.

# Args:
# data (List[Dict]): The data to upsert into Pinecone.

# Raises:
# ValueError: If the index has not been created before upserting data.
# """
# if not self.index_name:
# raise ValueError("Index must be created before upserting data")
# self.pc.Index(name=self.index_name).upsert(data)


# class WeaviateAdapter(Adapter):
# """
# Adapter class for interacting with Weaviate, a vector database service.
# """

# def __init__(self, api_key: str):
# """
# Initializes a new instance of the WeaviateAdapter class.

# Args:
# api_key (str): The API key for accessing the Weaviate service.
# """
# super().__init__(api_key)


# def create_index(self, dimension: int, metric: str = "cosine", index_name: str = "anything", **kwargs):
# """
# Creates a new index in Weaviate.

# Args:
# dimension (int): The dimensionality of the embeddings.
# metric (str, optional): The distance metric to use for similarity search. Defaults to "cosine".
# index_name (str, optional): The name of the index. Defaults to "anything".
# """
# pass

0 comments on commit 8dc4d65

Please sign in to comment.