This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.9' | |
networks: | |
net: | |
driver: bridge | |
services: | |
chromadb: | |
image: chromadb/chroma:latest | |
volumes: | |
- ./chromadb:/chroma/chroma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from llama_index.embeddings import OpenAIEmbedding | |
from llama_index.embeddings.base import BaseEmbedding | |
import chromadb | |
from chromadb.api.types import EmbeddingFunction | |
class LlamaIndexEmbeddingAdapter(EmbeddingFunction): | |
def __init__(self,ef:BaseEmbedding): | |
self.ef = ef | |
def __call__(self, input: Documents) -> Embeddings: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import chromadb | |
from chromadb.config import Settings | |
client = chromadb.PersistentClient(path="test", settings=Settings(allow_reset=True)) | |
client.reset() | |
col = client.get_or_create_collection("test") | |
col.add(ids=["1", "2", "3"], documents=["He is a technology freak and he loves AI topics", "AI technology are advancing at a fast pace", "Innovation in LLMs is a hot topic"]) | |
col.query(query_texts=["technology"], where_document={"$or":[{"$contains":"technology"}, {"$contains":"freak"}]}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
from chromadb.utils import embedding_functions | |
import chromadb | |
ef = embedding_functions.DefaultEmbeddingFunction() | |
docs = ["Article by john", "Article by Jack", "Article by Jill"] | |
client = chromadb.Client() | |
embeddings = ef(docs) | |
collection = client.get_or_create_collection("test-where-list") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
from chromadb.utils import embedding_functions | |
import chromadb | |
ef = embedding_functions.DefaultEmbeddingFunction() | |
docs = ["Article by john", "Article by Jack", "Article by Jill"] | |
client = chromadb.Client() | |
embeddings = ef(docs) | |
collection = client.get_or_create_collection("test-where-list") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
from chromadb.utils import embedding_functions | |
from langchain.schema import Document | |
from langchain.text_splitter import RecursiveCharacterTextSplitter | |
long_text = """ | |
The Downsides of LLMs (Logical Language Models) | |
In the age of artificial intelligence, Logical Language Models (LLMs) represent a significant leap forward in the field of natural language processing. These models are capable of comprehending, generating, and reasoning about human languages in a way that mimics human-like understanding. While the benefits of LLMs are numerous, it's essential to also recognize the downsides that accompany these advancements. This essay will explore the negative aspects of LLMs in terms of ethics, job displacement, security, and potential biases. |