norjala commited on
Commit
9d52cc3
1 Parent(s): 197f71b

Updated chunk settings

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -39,8 +39,8 @@ def tiktoken_len(text):
39
  return len(tokens)
40
 
41
  text_splitter = RecursiveCharacterTextSplitter(
42
- chunk_size=500,
43
- chunk_overlap=100,
44
  length_function = tiktoken_len
45
  )
46
 
@@ -83,7 +83,7 @@ llm = ChatOpenAI(model_name="gpt-4o")
83
 
84
  retrieval_augmented_qa_chain = (
85
  # INVOKE CHAIN WITH: {"query" : "<>"}
86
- # "query" : populated by getting the value of the "question" key
87
  # "context" : populated by getting the value of the "query" key and chaining it into the base_retriever
88
  {"context": itemgetter("query") | retriever, "query": itemgetter("query")}
89
  # "context" : is assigned to a RunnablePassthrough object (will not be called or considered in the next step)
@@ -121,7 +121,7 @@ async def handle_message(message: cl.Message):
121
 
122
  response = retrieval_augmented_qa_chain.invoke({"query": message.content})
123
 
124
- # Extracting and sending just the content
125
  content = response["response"].content
126
  pretty_content = content.strip()
127
 
 
39
  return len(tokens)
40
 
41
  text_splitter = RecursiveCharacterTextSplitter(
42
+ chunk_size=1000,
43
+ chunk_overlap=50,
44
  length_function = tiktoken_len
45
  )
46
 
 
83
 
84
  retrieval_augmented_qa_chain = (
85
  # INVOKE CHAIN WITH: {"query" : "<>"}
86
+ # "query" : populated by getting the value of the "query" key
87
  # "context" : populated by getting the value of the "query" key and chaining it into the base_retriever
88
  {"context": itemgetter("query") | retriever, "query": itemgetter("query")}
89
  # "context" : is assigned to a RunnablePassthrough object (will not be called or considered in the next step)
 
121
 
122
  response = retrieval_augmented_qa_chain.invoke({"query": message.content})
123
 
124
+ # Retrieve and sends content back to user
125
  content = response["response"].content
126
  pretty_content = content.strip()
127