Closed jrmi closed 2 weeks ago
Very good fix/workaround/improvement!
Thanks a lot :)
This was certainly an improvement!
I stumbled into it failing to write this though:
Sure, let's save that:
```save rag.py
...
return ToolSpec(
name="rag",
desc="RAG (Retrieval-Augmented Generation) for context-aware assistance",
instructions="""
Use RAG to index and search project documentation.
Commands:
- index [paths...] - Index documents in specified paths
- search <query> - Search indexed documents
- status - Show index status
""",
examples="""
> User: Index the current directory
```rag index```
> User: Search for documentation about functions
```rag search function documentation```
> User: Show index status
```rag status```
""",
block_types=["rag"],
execute=execute_rag,
available=True,
)
tool = init_rag()
```
(...message keeps going, doesn't get interrupted to execute save tool)
I assume this is due to the presence of ``` in the file, although they are indented, so they really shouldn't.
TL;DR; This MR fixes the bug when you have a markdown code block nested in another tooluse code block in streaming mode.
I think it's related to this issue #111
To reproduce
Create the file foo.md and add a small explanation on how works the async in python with a code example
The response of this prompt looks something like that: