Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

[Bugfix] fix chunker config bug (#1024)

Deven Pateldb37b2ac153e
diff --git a/docs/api-reference/advanced/configuration.mdx b/docs/api-reference/advanced/configuration.mdx
index fa8471851..2dfdc309e 100644
--- a/docs/api-reference/advanced/configuration.mdx
+++ b/docs/api-reference/advanced/configuration.mdx
@@ -53,6 +53,7 @@ chunker:
chunk_size: 2000
chunk_overlap: 100
length_function: 'len'
+ min_chunk_size: 0
```
```json config.json
@@ -91,7 +92,8 @@ chunker:
"chunker": {
"chunk_size": 2000,
"chunk_overlap": 100,
- "length_function": "len"
+ "length_function": "len",
+ "min_chunk_size": 0
}
}
```
@@ -138,7 +140,8 @@ config = {
'chunker': {
'chunk_size': 2000,
'chunk_overlap': 100,
- 'length_function': 'len'
+ 'length_function': 'len',
+ 'min_chunk_size': 0
}
}
```
diff --git a/embedchain/utils.py b/embedchain/utils.py
index ddb7d2d40..3838d8051 100644
--- a/embedchain/utils.py
+++ b/embedchain/utils.py
@@ -428,6 +428,7 @@ def validate_config(config_data):
Optional("chunk_size"): int,
Optional("chunk_overlap"): int,
Optional("length_function"): str,
+ Optional("min_chunk_size"): int,
},
}
)
diff --git a/examples/chainlit/app.py b/examples/chainlit/app.py
index 498dad666..5e8ba8557 100644
--- a/examples/chainlit/app.py
+++ b/examples/chainlit/app.py
@@ -1,24 +1,24 @@
+import os
+
import chainlit as cl
-from embedchain import Pipeline as App
-import os
+from embedchain import Pipeline as App
os.environ["OPENAI_API_KEY"] = "sk-xxx"
+
@cl.on_chat_start
async def on_chat_start():
- app = App.from_config(config={
- 'app': {
- 'config': {
- 'name': 'chainlit-app'
- }
- },
- 'llm': {
- 'config': {
- 'stream': True,
- }
+ app = App.from_config(
+ config={
+ "app": {"config": {"name": "chainlit-app"}},
+ "llm": {
+ "config": {
+ "stream": True,
+ }
+ },
}
- })
+ )
# import your data here
app.add("https://www.forbes.com/profile/elon-musk/")
app.collect_metrics = False
@@ -31,5 +31,5 @@ async def on_message(message: cl.Message):
msg = cl.Message(content="")
for chunk in await cl.make_async(app.chat)(message.content):
await msg.stream_token(chunk)
-
+
await msg.send()