Ross McNairn commited on
Commit ·
c18b115
1
Parent(s): 2ac9344
break apart into modules
Browse files- hello_wordsmith/datastores.py +65 -0
- hello_wordsmith/query_pipeline.py +65 -0
- hello_wordsmith/wordsmith.py +29 -109
- poetry.lock +122 -2
- pyproject.toml +3 -0
- storage/docstore.json +0 -0
hello_wordsmith/datastores.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
import chromadb
|
| 4 |
+
from llama_index.cli.rag import default_ragcli_persist_dir
|
| 5 |
+
from llama_index.core import SimpleDirectoryReader, StorageContext, VectorStoreIndex
|
| 6 |
+
from llama_index.core.storage.docstore import SimpleDocumentStore
|
| 7 |
+
from llama_index.vector_stores.chroma import ChromaVectorStore
|
| 8 |
+
from pydantic.v1 import BaseModel
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class InitialisedDataContainer(BaseModel):
|
| 12 |
+
class Config:
|
| 13 |
+
arbitrary_types_allowed = True
|
| 14 |
+
|
| 15 |
+
db: chromadb.Collection
|
| 16 |
+
doc_store: SimpleDocumentStore
|
| 17 |
+
vector_store: ChromaVectorStore
|
| 18 |
+
index: VectorStoreIndex
|
| 19 |
+
storage_context: StorageContext
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def _get_chroma_db() -> chromadb.Collection:
|
| 23 |
+
db = chromadb.PersistentClient(
|
| 24 |
+
path=os.path.join(default_ragcli_persist_dir(), "chroma")
|
| 25 |
+
)
|
| 26 |
+
chroma_collection = db.get_or_create_collection("wordsmith_rag_demo_index")
|
| 27 |
+
return chroma_collection
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def fetch_or_initialise_datastores() -> InitialisedDataContainer:
|
| 31 |
+
db = _get_chroma_db()
|
| 32 |
+
vector_store = ChromaVectorStore(chroma_collection=db)
|
| 33 |
+
try:
|
| 34 |
+
docstore = SimpleDocumentStore.from_persist_dir(
|
| 35 |
+
persist_dir=os.path.join(default_ragcli_persist_dir(), "storage")
|
| 36 |
+
)
|
| 37 |
+
except FileNotFoundError:
|
| 38 |
+
docstore = SimpleDocumentStore()
|
| 39 |
+
storage_context = StorageContext.from_defaults(
|
| 40 |
+
vector_store=vector_store, docstore=docstore
|
| 41 |
+
)
|
| 42 |
+
if not docstore.docs or not db.count():
|
| 43 |
+
package_directory = os.path.dirname(os.path.abspath(__file__))
|
| 44 |
+
dataset_path = os.path.join(package_directory, "public_wordsmith_dataset")
|
| 45 |
+
docs = SimpleDirectoryReader(
|
| 46 |
+
input_dir=dataset_path, filename_as_id=True
|
| 47 |
+
).load_data()
|
| 48 |
+
docstore.add_documents(docs)
|
| 49 |
+
docstore.persist(
|
| 50 |
+
persist_path=os.path.join(
|
| 51 |
+
default_ragcli_persist_dir(), "./storage/docstore.json"
|
| 52 |
+
)
|
| 53 |
+
)
|
| 54 |
+
index = VectorStoreIndex.from_documents(
|
| 55 |
+
documents=docs, storage_context=storage_context
|
| 56 |
+
)
|
| 57 |
+
else:
|
| 58 |
+
index = VectorStoreIndex.from_vector_store(vector_store=vector_store)
|
| 59 |
+
return InitialisedDataContainer(
|
| 60 |
+
db=db,
|
| 61 |
+
doc_store=docstore,
|
| 62 |
+
vector_store=vector_store,
|
| 63 |
+
index=index,
|
| 64 |
+
storage_context=storage_context,
|
| 65 |
+
)
|
hello_wordsmith/query_pipeline.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from llama_index.core import ChatPromptTemplate, VectorStoreIndex
|
| 2 |
+
from llama_index.core.base.llms.types import ChatMessage, MessageRole
|
| 3 |
+
from llama_index.core.query_pipeline import InputComponent, QueryPipeline
|
| 4 |
+
from llama_index.core.response_synthesizers import TreeSummarize
|
| 5 |
+
from llama_index.llms.openai import OpenAI
|
| 6 |
+
|
| 7 |
+
_system_prompt = ChatMessage(
|
| 8 |
+
content=(
|
| 9 |
+
"You are an expert Q&A analyst representing Wordsmith in front of "
|
| 10 |
+
"potentially interested users.\n"
|
| 11 |
+
"If the question is related to Wordsmith in any way, "
|
| 12 |
+
"answer the query using the provided context information.\n"
|
| 13 |
+
"If you can't find the answer in the provided context information, "
|
| 14 |
+
"simply say you don't have enough information to answer the query.\n"
|
| 15 |
+
"Always be polite and professional.\n"
|
| 16 |
+
"Some rules to follow:\n"
|
| 17 |
+
"1. Never directly reference the given context in your answer.\n"
|
| 18 |
+
"2. Avoid statements like 'Based on the context, ...' or "
|
| 19 |
+
"'The context information ...', etc."
|
| 20 |
+
),
|
| 21 |
+
role=MessageRole.SYSTEM,
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
_chat_template_messages = [
|
| 25 |
+
_system_prompt,
|
| 26 |
+
ChatMessage(
|
| 27 |
+
content=(
|
| 28 |
+
"Context information from multiple sources is below.\n"
|
| 29 |
+
"---------------------\n"
|
| 30 |
+
"{context_str}\n"
|
| 31 |
+
"---------------------\n"
|
| 32 |
+
"Given the information from multiple sources and not prior knowledge, "
|
| 33 |
+
"answer the query.\n"
|
| 34 |
+
"Query: {query_str}\n"
|
| 35 |
+
"Answer: "
|
| 36 |
+
),
|
| 37 |
+
role=MessageRole.USER,
|
| 38 |
+
),
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
_TOP_K_RETRIEVAL = 20
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def configure_query_pipeline(*, index: VectorStoreIndex, llm: OpenAI) -> QueryPipeline:
|
| 45 |
+
"""Configure and set up the query pipeline"""
|
| 46 |
+
text_qa_chat_template = ChatPromptTemplate.from_messages(_chat_template_messages)
|
| 47 |
+
query_pipeline = QueryPipeline()
|
| 48 |
+
|
| 49 |
+
retriever = index.as_retriever(similarity_top_k=_TOP_K_RETRIEVAL)
|
| 50 |
+
summarizer = TreeSummarize(
|
| 51 |
+
llm=llm, streaming=True, summary_template=text_qa_chat_template
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
query_pipeline.add_modules(
|
| 55 |
+
{
|
| 56 |
+
"input": InputComponent(),
|
| 57 |
+
"retriever": retriever,
|
| 58 |
+
"summarizer": summarizer,
|
| 59 |
+
}
|
| 60 |
+
)
|
| 61 |
+
query_pipeline.add_link("input", "retriever")
|
| 62 |
+
query_pipeline.add_link("input", "summarizer", dest_key="query_str")
|
| 63 |
+
query_pipeline.add_link("retriever", "summarizer", dest_key="nodes")
|
| 64 |
+
|
| 65 |
+
return query_pipeline
|
hello_wordsmith/wordsmith.py
CHANGED
|
@@ -1,104 +1,15 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
|
|
|
| 3 |
|
| 4 |
-
import
|
| 5 |
-
from llama_index.
|
| 6 |
-
from llama_index.core import (ChatPromptTemplate, Settings,
|
| 7 |
-
SimpleDirectoryReader, StorageContext,
|
| 8 |
-
VectorStoreIndex)
|
| 9 |
-
from llama_index.core.base.llms.types import ChatMessage, MessageRole
|
| 10 |
from llama_index.core.ingestion import IngestionCache, IngestionPipeline
|
| 11 |
-
from llama_index.
|
| 12 |
-
from llama_index.core.response_synthesizers import TreeSummarize
|
| 13 |
-
from llama_index.core.storage.docstore import SimpleDocumentStore
|
| 14 |
-
from llama_index.embeddings.openai import (OpenAIEmbedding,
|
| 15 |
-
OpenAIEmbeddingModelType)
|
| 16 |
from llama_index.llms.openai import OpenAI
|
| 17 |
-
from llama_index.vector_stores.chroma import ChromaVectorStore
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
def initialize_chroma_db():
|
| 23 |
-
db = chromadb.PersistentClient(
|
| 24 |
-
path=os.path.join(default_ragcli_persist_dir(), "chroma")
|
| 25 |
-
)
|
| 26 |
-
chroma_collection = db.get_or_create_collection("wordsmith_rag_demo_index")
|
| 27 |
-
vector_store = ChromaVectorStore(chroma_collection=chroma_collection)
|
| 28 |
-
return vector_store
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
def setup_document_storage(*, vector_store, storage_context):
|
| 32 |
-
package_directory = os.path.dirname(os.path.abspath(__file__))
|
| 33 |
-
dataset_path = os.path.join(package_directory, "public_wordsmith_dataset")
|
| 34 |
-
reader = SimpleDirectoryReader(input_dir=dataset_path)
|
| 35 |
-
docs = reader.load_data()
|
| 36 |
-
index = VectorStoreIndex.from_documents(docs, storage_context=storage_context)
|
| 37 |
-
return index
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
def initialize_llm():
|
| 41 |
-
llm = OpenAI(api_key=os.environ["OPENAI_API_KEY"], model="gpt-4")
|
| 42 |
-
return llm
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
_system_prompt = ChatMessage(
|
| 46 |
-
content=(
|
| 47 |
-
"You are an expert Q&A analyst representing Wordsmith in front of "
|
| 48 |
-
"potentially interested users.\n"
|
| 49 |
-
"If the question is related to Wordsmith in any way, "
|
| 50 |
-
"answer the query using the provided context information.\n"
|
| 51 |
-
"If you can't find the answer in the provided context information, "
|
| 52 |
-
"simply say you don't have enough information to answer the query.\n"
|
| 53 |
-
"Always be polite and professional.\n"
|
| 54 |
-
"Some rules to follow:\n"
|
| 55 |
-
"1. Never directly reference the given context in your answer.\n"
|
| 56 |
-
"2. Avoid statements like 'Based on the context, ...' or "
|
| 57 |
-
"'The context information ...', etc."
|
| 58 |
-
),
|
| 59 |
-
role=MessageRole.SYSTEM,
|
| 60 |
-
)
|
| 61 |
-
|
| 62 |
-
_chat_template_messages = [
|
| 63 |
-
_system_prompt,
|
| 64 |
-
ChatMessage(
|
| 65 |
-
content=(
|
| 66 |
-
"Context information from multiple sources is below.\n"
|
| 67 |
-
"---------------------\n"
|
| 68 |
-
"{context_str}\n"
|
| 69 |
-
"---------------------\n"
|
| 70 |
-
"Given the information from multiple sources and not prior knowledge, "
|
| 71 |
-
"answer the query.\n"
|
| 72 |
-
"Query: {query_str}\n"
|
| 73 |
-
"Answer: "
|
| 74 |
-
),
|
| 75 |
-
role=MessageRole.USER,
|
| 76 |
-
),
|
| 77 |
-
]
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
def configure_query_pipeline(index, llm):
|
| 81 |
-
"""Configure and set up the query pipeline"""
|
| 82 |
-
text_qa_chat_template = ChatPromptTemplate.from_messages(_chat_template_messages)
|
| 83 |
-
query_pipeline = QueryPipeline()
|
| 84 |
-
|
| 85 |
-
retriever = index.as_retriever(similarity_top_k=20)
|
| 86 |
-
summarizer = TreeSummarize(
|
| 87 |
-
llm=llm, streaming=True, summary_template=text_qa_chat_template
|
| 88 |
-
)
|
| 89 |
-
|
| 90 |
-
query_pipeline.add_modules(
|
| 91 |
-
{
|
| 92 |
-
"input": InputComponent(),
|
| 93 |
-
"retriever": retriever,
|
| 94 |
-
"summarizer": summarizer,
|
| 95 |
-
}
|
| 96 |
-
)
|
| 97 |
-
query_pipeline.add_link("input", "retriever")
|
| 98 |
-
query_pipeline.add_link("input", "summarizer", dest_key="query_str")
|
| 99 |
-
query_pipeline.add_link("retriever", "summarizer", dest_key="nodes")
|
| 100 |
-
|
| 101 |
-
return query_pipeline
|
| 102 |
|
| 103 |
|
| 104 |
class WordsmithRAGCLI(RagCLI):
|
|
@@ -113,22 +24,31 @@ class WordsmithRAGCLI(RagCLI):
|
|
| 113 |
super().cli()
|
| 114 |
|
| 115 |
|
| 116 |
-
def
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
ingestion_pipeline = IngestionPipeline(
|
| 129 |
-
vector_store=vector_store,
|
| 130 |
cache=IngestionCache(),
|
| 131 |
-
docstore=
|
| 132 |
)
|
| 133 |
rag_cli_instance = WordsmithRAGCLI(
|
| 134 |
ingestion_pipeline=ingestion_pipeline, llm=llm, query_pipeline=query_pipeline
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
+
from typing import Callable
|
| 4 |
|
| 5 |
+
from llama_index.cli.rag import RagCLI
|
| 6 |
+
from llama_index.core import Settings
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
from llama_index.core.ingestion import IngestionCache, IngestionPipeline
|
| 8 |
+
from llama_index.embeddings.openai import OpenAIEmbedding, OpenAIEmbeddingModelType
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from llama_index.llms.openai import OpenAI
|
|
|
|
| 10 |
|
| 11 |
+
from .datastores import fetch_or_initialise_datastores
|
| 12 |
+
from .query_pipeline import configure_query_pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
class WordsmithRAGCLI(RagCLI):
|
|
|
|
| 24 |
super().cli()
|
| 25 |
|
| 26 |
|
| 27 |
+
def _init_env(func: Callable[[], None]) -> Callable[[], None]:
|
| 28 |
+
def wrapper() -> None:
|
| 29 |
+
api_key = os.getenv("OPENAI_API_KEY")
|
| 30 |
+
if not api_key:
|
| 31 |
+
print(
|
| 32 |
+
"Error: Environment variable 'OPENAI_API_KEY' is not set. Please set this before running."
|
| 33 |
+
)
|
| 34 |
+
sys.exit(1)
|
| 35 |
+
Settings.embed_model = OpenAIEmbedding(
|
| 36 |
+
model=OpenAIEmbeddingModelType.TEXT_EMBED_3_SMALL
|
| 37 |
+
)
|
| 38 |
+
return func()
|
| 39 |
+
|
| 40 |
+
return wrapper
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
@_init_env
|
| 44 |
+
def main() -> None:
|
| 45 |
+
datastore_container = fetch_or_initialise_datastores()
|
| 46 |
+
llm = OpenAI(api_key=os.environ["OPENAI_API_KEY"], model="gpt-4")
|
| 47 |
+
query_pipeline = configure_query_pipeline(index=datastore_container.index, llm=llm)
|
| 48 |
ingestion_pipeline = IngestionPipeline(
|
| 49 |
+
vector_store=datastore_container.vector_store,
|
| 50 |
cache=IngestionCache(),
|
| 51 |
+
docstore=datastore_container.doc_store,
|
| 52 |
)
|
| 53 |
rag_cli_instance = WordsmithRAGCLI(
|
| 54 |
ingestion_pipeline=ingestion_pipeline, llm=llm, query_pipeline=query_pipeline
|
poetry.lock
CHANGED
|
@@ -265,6 +265,52 @@ charset-normalizer = ["charset-normalizer"]
|
|
| 265 |
html5lib = ["html5lib"]
|
| 266 |
lxml = ["lxml"]
|
| 267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
[[package]]
|
| 269 |
name = "build"
|
| 270 |
version = "1.2.1"
|
|
@@ -1594,6 +1640,53 @@ files = [
|
|
| 1594 |
{file = "multidict-6.0.5.tar.gz", hash = "sha256:f7e301075edaf50500f0b341543c41194d8df3ae5caf4702f2095f3ca73dd8da"},
|
| 1595 |
]
|
| 1596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1597 |
[[package]]
|
| 1598 |
name = "mypy-extensions"
|
| 1599 |
version = "1.0.0"
|
|
@@ -2053,8 +2146,8 @@ files = [
|
|
| 2053 |
[package.dependencies]
|
| 2054 |
numpy = [
|
| 2055 |
{version = ">=1.20.3", markers = "python_version < \"3.10\""},
|
| 2056 |
-
{version = ">=1.21.0", markers = "python_version >= \"3.10\" and python_version < \"3.11\""},
|
| 2057 |
{version = ">=1.23.2", markers = "python_version >= \"3.11\""},
|
|
|
|
| 2058 |
]
|
| 2059 |
python-dateutil = ">=2.8.2"
|
| 2060 |
pytz = ">=2020.1"
|
|
@@ -2083,6 +2176,17 @@ sql-other = ["SQLAlchemy (>=1.4.16)"]
|
|
| 2083 |
test = ["hypothesis (>=6.34.2)", "pytest (>=7.3.2)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)"]
|
| 2084 |
xml = ["lxml (>=4.6.3)"]
|
| 2085 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2086 |
[[package]]
|
| 2087 |
name = "pillow"
|
| 2088 |
version = "10.3.0"
|
|
@@ -2169,6 +2273,22 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa
|
|
| 2169 |
typing = ["typing-extensions"]
|
| 2170 |
xmp = ["defusedxml"]
|
| 2171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2172 |
[[package]]
|
| 2173 |
name = "posthog"
|
| 2174 |
version = "3.5.0"
|
|
@@ -3603,4 +3723,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
|
|
| 3603 |
[metadata]
|
| 3604 |
lock-version = "2.0"
|
| 3605 |
python-versions = "^3.8.1"
|
| 3606 |
-
content-hash = "
|
|
|
|
| 265 |
html5lib = ["html5lib"]
|
| 266 |
lxml = ["lxml"]
|
| 267 |
|
| 268 |
+
[[package]]
|
| 269 |
+
name = "black"
|
| 270 |
+
version = "24.4.2"
|
| 271 |
+
description = "The uncompromising code formatter."
|
| 272 |
+
optional = false
|
| 273 |
+
python-versions = ">=3.8"
|
| 274 |
+
files = [
|
| 275 |
+
{file = "black-24.4.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dd1b5a14e417189db4c7b64a6540f31730713d173f0b63e55fabd52d61d8fdce"},
|
| 276 |
+
{file = "black-24.4.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e537d281831ad0e71007dcdcbe50a71470b978c453fa41ce77186bbe0ed6021"},
|
| 277 |
+
{file = "black-24.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaea3008c281f1038edb473c1aa8ed8143a5535ff18f978a318f10302b254063"},
|
| 278 |
+
{file = "black-24.4.2-cp310-cp310-win_amd64.whl", hash = "sha256:7768a0dbf16a39aa5e9a3ded568bb545c8c2727396d063bbaf847df05b08cd96"},
|
| 279 |
+
{file = "black-24.4.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:257d724c2c9b1660f353b36c802ccece186a30accc7742c176d29c146df6e474"},
|
| 280 |
+
{file = "black-24.4.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bdde6f877a18f24844e381d45e9947a49e97933573ac9d4345399be37621e26c"},
|
| 281 |
+
{file = "black-24.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e151054aa00bad1f4e1f04919542885f89f5f7d086b8a59e5000e6c616896ffb"},
|
| 282 |
+
{file = "black-24.4.2-cp311-cp311-win_amd64.whl", hash = "sha256:7e122b1c4fb252fd85df3ca93578732b4749d9be076593076ef4d07a0233c3e1"},
|
| 283 |
+
{file = "black-24.4.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:accf49e151c8ed2c0cdc528691838afd217c50412534e876a19270fea1e28e2d"},
|
| 284 |
+
{file = "black-24.4.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:88c57dc656038f1ab9f92b3eb5335ee9b021412feaa46330d5eba4e51fe49b04"},
|
| 285 |
+
{file = "black-24.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be8bef99eb46d5021bf053114442914baeb3649a89dc5f3a555c88737e5e98fc"},
|
| 286 |
+
{file = "black-24.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:415e686e87dbbe6f4cd5ef0fbf764af7b89f9057b97c908742b6008cc554b9c0"},
|
| 287 |
+
{file = "black-24.4.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bf10f7310db693bb62692609b397e8d67257c55f949abde4c67f9cc574492cc7"},
|
| 288 |
+
{file = "black-24.4.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:98e123f1d5cfd42f886624d84464f7756f60ff6eab89ae845210631714f6db94"},
|
| 289 |
+
{file = "black-24.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:48a85f2cb5e6799a9ef05347b476cce6c182d6c71ee36925a6c194d074336ef8"},
|
| 290 |
+
{file = "black-24.4.2-cp38-cp38-win_amd64.whl", hash = "sha256:b1530ae42e9d6d5b670a34db49a94115a64596bc77710b1d05e9801e62ca0a7c"},
|
| 291 |
+
{file = "black-24.4.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:37aae07b029fa0174d39daf02748b379399b909652a806e5708199bd93899da1"},
|
| 292 |
+
{file = "black-24.4.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:da33a1a5e49c4122ccdfd56cd021ff1ebc4a1ec4e2d01594fef9b6f267a9e741"},
|
| 293 |
+
{file = "black-24.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef703f83fc32e131e9bcc0a5094cfe85599e7109f896fe8bc96cc402f3eb4b6e"},
|
| 294 |
+
{file = "black-24.4.2-cp39-cp39-win_amd64.whl", hash = "sha256:b9176b9832e84308818a99a561e90aa479e73c523b3f77afd07913380ae2eab7"},
|
| 295 |
+
{file = "black-24.4.2-py3-none-any.whl", hash = "sha256:d36ed1124bb81b32f8614555b34cc4259c3fbc7eec17870e8ff8ded335b58d8c"},
|
| 296 |
+
{file = "black-24.4.2.tar.gz", hash = "sha256:c872b53057f000085da66a19c55d68f6f8ddcac2642392ad3a355878406fbd4d"},
|
| 297 |
+
]
|
| 298 |
+
|
| 299 |
+
[package.dependencies]
|
| 300 |
+
click = ">=8.0.0"
|
| 301 |
+
mypy-extensions = ">=0.4.3"
|
| 302 |
+
packaging = ">=22.0"
|
| 303 |
+
pathspec = ">=0.9.0"
|
| 304 |
+
platformdirs = ">=2"
|
| 305 |
+
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
|
| 306 |
+
typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""}
|
| 307 |
+
|
| 308 |
+
[package.extras]
|
| 309 |
+
colorama = ["colorama (>=0.4.3)"]
|
| 310 |
+
d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"]
|
| 311 |
+
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
|
| 312 |
+
uvloop = ["uvloop (>=0.15.2)"]
|
| 313 |
+
|
| 314 |
[[package]]
|
| 315 |
name = "build"
|
| 316 |
version = "1.2.1"
|
|
|
|
| 1640 |
{file = "multidict-6.0.5.tar.gz", hash = "sha256:f7e301075edaf50500f0b341543c41194d8df3ae5caf4702f2095f3ca73dd8da"},
|
| 1641 |
]
|
| 1642 |
|
| 1643 |
+
[[package]]
|
| 1644 |
+
name = "mypy"
|
| 1645 |
+
version = "1.10.0"
|
| 1646 |
+
description = "Optional static typing for Python"
|
| 1647 |
+
optional = false
|
| 1648 |
+
python-versions = ">=3.8"
|
| 1649 |
+
files = [
|
| 1650 |
+
{file = "mypy-1.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:da1cbf08fb3b851ab3b9523a884c232774008267b1f83371ace57f412fe308c2"},
|
| 1651 |
+
{file = "mypy-1.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:12b6bfc1b1a66095ab413160a6e520e1dc076a28f3e22f7fb25ba3b000b4ef99"},
|
| 1652 |
+
{file = "mypy-1.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e36fb078cce9904c7989b9693e41cb9711e0600139ce3970c6ef814b6ebc2b2"},
|
| 1653 |
+
{file = "mypy-1.10.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2b0695d605ddcd3eb2f736cd8b4e388288c21e7de85001e9f85df9187f2b50f9"},
|
| 1654 |
+
{file = "mypy-1.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:cd777b780312ddb135bceb9bc8722a73ec95e042f911cc279e2ec3c667076051"},
|
| 1655 |
+
{file = "mypy-1.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3be66771aa5c97602f382230165b856c231d1277c511c9a8dd058be4784472e1"},
|
| 1656 |
+
{file = "mypy-1.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8b2cbaca148d0754a54d44121b5825ae71868c7592a53b7292eeb0f3fdae95ee"},
|
| 1657 |
+
{file = "mypy-1.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ec404a7cbe9fc0e92cb0e67f55ce0c025014e26d33e54d9e506a0f2d07fe5de"},
|
| 1658 |
+
{file = "mypy-1.10.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e22e1527dc3d4aa94311d246b59e47f6455b8729f4968765ac1eacf9a4760bc7"},
|
| 1659 |
+
{file = "mypy-1.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:a87dbfa85971e8d59c9cc1fcf534efe664d8949e4c0b6b44e8ca548e746a8d53"},
|
| 1660 |
+
{file = "mypy-1.10.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:a781f6ad4bab20eef8b65174a57e5203f4be627b46291f4589879bf4e257b97b"},
|
| 1661 |
+
{file = "mypy-1.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b808e12113505b97d9023b0b5e0c0705a90571c6feefc6f215c1df9381256e30"},
|
| 1662 |
+
{file = "mypy-1.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f55583b12156c399dce2df7d16f8a5095291354f1e839c252ec6c0611e86e2e"},
|
| 1663 |
+
{file = "mypy-1.10.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4cf18f9d0efa1b16478c4c129eabec36148032575391095f73cae2e722fcf9d5"},
|
| 1664 |
+
{file = "mypy-1.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:bc6ac273b23c6b82da3bb25f4136c4fd42665f17f2cd850771cb600bdd2ebeda"},
|
| 1665 |
+
{file = "mypy-1.10.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9fd50226364cd2737351c79807775136b0abe084433b55b2e29181a4c3c878c0"},
|
| 1666 |
+
{file = "mypy-1.10.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f90cff89eea89273727d8783fef5d4a934be2fdca11b47def50cf5d311aff727"},
|
| 1667 |
+
{file = "mypy-1.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fcfc70599efde5c67862a07a1aaf50e55bce629ace26bb19dc17cece5dd31ca4"},
|
| 1668 |
+
{file = "mypy-1.10.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:075cbf81f3e134eadaf247de187bd604748171d6b79736fa9b6c9685b4083061"},
|
| 1669 |
+
{file = "mypy-1.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:3f298531bca95ff615b6e9f2fc0333aae27fa48052903a0ac90215021cdcfa4f"},
|
| 1670 |
+
{file = "mypy-1.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:fa7ef5244615a2523b56c034becde4e9e3f9b034854c93639adb667ec9ec2976"},
|
| 1671 |
+
{file = "mypy-1.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3236a4c8f535a0631f85f5fcdffba71c7feeef76a6002fcba7c1a8e57c8be1ec"},
|
| 1672 |
+
{file = "mypy-1.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a2b5cdbb5dd35aa08ea9114436e0d79aceb2f38e32c21684dcf8e24e1e92821"},
|
| 1673 |
+
{file = "mypy-1.10.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:92f93b21c0fe73dc00abf91022234c79d793318b8a96faac147cd579c1671746"},
|
| 1674 |
+
{file = "mypy-1.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:28d0e038361b45f099cc086d9dd99c15ff14d0188f44ac883010e172ce86c38a"},
|
| 1675 |
+
{file = "mypy-1.10.0-py3-none-any.whl", hash = "sha256:f8c083976eb530019175aabadb60921e73b4f45736760826aa1689dda8208aee"},
|
| 1676 |
+
{file = "mypy-1.10.0.tar.gz", hash = "sha256:3d087fcbec056c4ee34974da493a826ce316947485cef3901f511848e687c131"},
|
| 1677 |
+
]
|
| 1678 |
+
|
| 1679 |
+
[package.dependencies]
|
| 1680 |
+
mypy-extensions = ">=1.0.0"
|
| 1681 |
+
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
|
| 1682 |
+
typing-extensions = ">=4.1.0"
|
| 1683 |
+
|
| 1684 |
+
[package.extras]
|
| 1685 |
+
dmypy = ["psutil (>=4.0)"]
|
| 1686 |
+
install-types = ["pip"]
|
| 1687 |
+
mypyc = ["setuptools (>=50)"]
|
| 1688 |
+
reports = ["lxml"]
|
| 1689 |
+
|
| 1690 |
[[package]]
|
| 1691 |
name = "mypy-extensions"
|
| 1692 |
version = "1.0.0"
|
|
|
|
| 2146 |
[package.dependencies]
|
| 2147 |
numpy = [
|
| 2148 |
{version = ">=1.20.3", markers = "python_version < \"3.10\""},
|
|
|
|
| 2149 |
{version = ">=1.23.2", markers = "python_version >= \"3.11\""},
|
| 2150 |
+
{version = ">=1.21.0", markers = "python_version >= \"3.10\" and python_version < \"3.11\""},
|
| 2151 |
]
|
| 2152 |
python-dateutil = ">=2.8.2"
|
| 2153 |
pytz = ">=2020.1"
|
|
|
|
| 2176 |
test = ["hypothesis (>=6.34.2)", "pytest (>=7.3.2)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)"]
|
| 2177 |
xml = ["lxml (>=4.6.3)"]
|
| 2178 |
|
| 2179 |
+
[[package]]
|
| 2180 |
+
name = "pathspec"
|
| 2181 |
+
version = "0.12.1"
|
| 2182 |
+
description = "Utility library for gitignore style pattern matching of file paths."
|
| 2183 |
+
optional = false
|
| 2184 |
+
python-versions = ">=3.8"
|
| 2185 |
+
files = [
|
| 2186 |
+
{file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"},
|
| 2187 |
+
{file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"},
|
| 2188 |
+
]
|
| 2189 |
+
|
| 2190 |
[[package]]
|
| 2191 |
name = "pillow"
|
| 2192 |
version = "10.3.0"
|
|
|
|
| 2273 |
typing = ["typing-extensions"]
|
| 2274 |
xmp = ["defusedxml"]
|
| 2275 |
|
| 2276 |
+
[[package]]
|
| 2277 |
+
name = "platformdirs"
|
| 2278 |
+
version = "4.2.1"
|
| 2279 |
+
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
|
| 2280 |
+
optional = false
|
| 2281 |
+
python-versions = ">=3.8"
|
| 2282 |
+
files = [
|
| 2283 |
+
{file = "platformdirs-4.2.1-py3-none-any.whl", hash = "sha256:17d5a1161b3fd67b390023cb2d3b026bbd40abde6fdb052dfbd3a29c3ba22ee1"},
|
| 2284 |
+
{file = "platformdirs-4.2.1.tar.gz", hash = "sha256:031cd18d4ec63ec53e82dceaac0417d218a6863f7745dfcc9efe7793b7039bdf"},
|
| 2285 |
+
]
|
| 2286 |
+
|
| 2287 |
+
[package.extras]
|
| 2288 |
+
docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"]
|
| 2289 |
+
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"]
|
| 2290 |
+
type = ["mypy (>=1.8)"]
|
| 2291 |
+
|
| 2292 |
[[package]]
|
| 2293 |
name = "posthog"
|
| 2294 |
version = "3.5.0"
|
|
|
|
| 3723 |
[metadata]
|
| 3724 |
lock-version = "2.0"
|
| 3725 |
python-versions = "^3.8.1"
|
| 3726 |
+
content-hash = "7f3728a66e787b751b7d4564bf9e83cd6fec93b87cedebd5001ecd2a354b7490"
|
pyproject.toml
CHANGED
|
@@ -25,8 +25,11 @@ llama-index-embeddings-openai = "~0.1.9"
|
|
| 25 |
llama-index-vector-stores-chroma = "~0.1.7"
|
| 26 |
llama-index-cli = "~0.1.12"
|
| 27 |
llama-index-readers-file = "~0.1.19"
|
|
|
|
| 28 |
|
| 29 |
[tool.poetry.dev-dependencies]
|
|
|
|
|
|
|
| 30 |
|
| 31 |
[build-system]
|
| 32 |
requires = ["poetry-core>=1.0.0"]
|
|
|
|
| 25 |
llama-index-vector-stores-chroma = "~0.1.7"
|
| 26 |
llama-index-cli = "~0.1.12"
|
| 27 |
llama-index-readers-file = "~0.1.19"
|
| 28 |
+
pydantic = "~2.7.1"
|
| 29 |
|
| 30 |
[tool.poetry.dev-dependencies]
|
| 31 |
+
black = "24.4.2"
|
| 32 |
+
mypy = "1.10.0"
|
| 33 |
|
| 34 |
[build-system]
|
| 35 |
requires = ["poetry-core>=1.0.0"]
|
storage/docstore.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|