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

Fix chat-langchain app can't run locally #120

Open
wants to merge 1 commit into
base: master
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
3 changes: 2 additions & 1 deletion ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ def ingest_docs():
client.schema.delete_class("LangChain_newest_idx") # delete the class if it already exists

embeddings = OpenAIEmbeddings(chunk_size=200) # rate limit
weav = Weaviate(client=client, index_name="LangChain_newest_idx", text_key="text", embedding=embeddings, by_text=False)

batch_size = 100 # to handle batch size limit
for i in range(0, len(docs_transformed), batch_size):
batch = docs_transformed[i:i+batch_size]
Weaviate.add_documents(batch, embeddings, client=client, by_text=False, index_name="LangChain_newest_idx")
weav.add_documents(batch)

print("LangChain now has this many vectors", client.query.aggregate("LangChain_newest_idx").with_meta_count().do())

Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def create_chain(
]
)

final_model = ChatOpenAI(model="gpt-4") if model_provider == "openai" else ChatAnthropic(model_name="claude-2")
final_model = ChatOpenAI(model="gpt-3.5-turbo-16k") if model_provider == "openai" else ChatAnthropic(model_name="claude-2")
chain = (
_inputs
| _context
Expand All @@ -142,7 +142,7 @@ def _get_retriever():
)
weaviate_client = Weaviate(
client=client,
index_name="LangChain_test_idx",
index_name="LangChain_newest_idx",
text_key="text",
embedding=embeddings,
by_text=False,
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ unstructured
libmagic
tiktoken
weaviate-client
anthropic
anthropic
GitPython
html2text