Skip to content

Commit c362229

Browse files
committed
docs: cleanup langchain-chroma example
1 parent de36a48 commit c362229

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

examples/langchain-chroma/query.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,14 @@
22
import os
33
from langchain.vectorstores import Chroma
44
from langchain.embeddings import OpenAIEmbeddings
5-
from langchain.text_splitter import RecursiveCharacterTextSplitter,CharacterTextSplitter
65
from langchain.llms import OpenAI
76
from langchain.chains import VectorDBQA
8-
from langchain.document_loaders import TextLoader
97

108
base_path = os.environ.get('OPENAI_API_BASE', 'http://localhost:8080/v1')
119

1210
# Load and process the text
13-
loader = TextLoader('state_of_the_union.txt')
14-
documents = loader.load()
15-
16-
text_splitter = CharacterTextSplitter(chunk_size=300, chunk_overlap=70)
17-
texts = text_splitter.split_documents(documents)
18-
19-
# Embed and store the texts
20-
# Supplying a persist_directory will store the embeddings on disk
21-
persist_directory = 'db'
22-
2311
embedding = OpenAIEmbeddings()
12+
persist_directory = 'db'
2413

2514
# Now we can load the persisted database from disk, and use it as normal.
2615
vectordb = Chroma(persist_directory=persist_directory, embedding_function=embedding)

0 commit comments

Comments
 (0)