Skip to content

Commit 3f494d5

Browse files
committed
docs(tutorials)📝: Update the recording prompts tutorial for better clarity and integration
- Revised the tutorial introduction to include a how-to guide format. - Added metadata section with intents and linked files for better navigation. - Updated import paths to reflect new module structure in llamabot. - Changed parameter name from 'doc_paths' to 'document_paths' for consistency.
1 parent 94d7165 commit 3f494d5

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

‎docs/tutorials/recording_prompts.md‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
# Automatically Record QueryBot Calls with PromptRecorder
1+
---
2+
intents:
3+
- This should be a how-to guide that shows a user how the PromptRecorder in LlamaBot
4+
works in tandem with QueryBot, specifically using it as a context manager.
5+
- Specifically, how one sets it up, views recorded prompts and responses, and how
6+
to display them in a Panel app.
7+
linked_files:
8+
- llamabot/recorder.py
9+
- llamabot/bot/querybot.py
10+
---
211

3-
!!! note
4-
This tutorial was written by GPT4 and edited by a human.
12+
# Automatically Record QueryBot Calls with PromptRecorder
513

614
In this tutorial, we will learn how to use the `PromptRecorder` class to automatically record calls made to the `QueryBot`. The `PromptRecorder` class is designed to record prompts and responses, making it a perfect fit for logging interactions with the `QueryBot`.
715

@@ -23,8 +31,8 @@ pip install pandas panel
2331
First, we need to import the `PromptRecorder` and `QueryBot` classes from their respective source files. You can do this by adding the following lines at the beginning of your script:
2432

2533
```python
26-
from prompt_recorder import PromptRecorder, autorecord
27-
from query_bot import QueryBot
34+
from llamabot.recorder import PromptRecorder, autorecord
35+
from llamabot.bot.querybot import QueryBot
2836
```
2937

3038
## Step 2: Initialize the QueryBot
@@ -36,7 +44,7 @@ system_message = "You are a helpful assistant that can answer questions based on
3644
model_name = "gpt-4"
3745
doc_paths = ["document1.txt", "document2.txt"]
3846

39-
query_bot = QueryBot(system_message, model_name=model_name, doc_paths=doc_paths)
47+
query_bot = QueryBot(system_message, model_name=model_name, document_paths=doc_paths)
4048
```
4149

4250
## Step 3: Use the PromptRecorder context manager
@@ -84,14 +92,14 @@ recorder.panel().show()
8492
Here's the complete example that demonstrates how to use the `PromptRecorder` to automatically record `QueryBot` calls:
8593

8694
```python
87-
from prompt_recorder import PromptRecorder, autorecord
88-
from query_bot import QueryBot
95+
from llamabot.recorder import PromptRecorder, autorecord
96+
from llamabot.bot.querybot import QueryBot
8997

9098
system_message = "You are a helpful assistant that can answer questions based on the provided documents."
9199
model_name = "gpt-4"
92100
doc_paths = ["document1.txt", "document2.txt"]
93101

94-
query_bot = QueryBot(system_message, model_name=model_name, doc_paths=doc_paths)
102+
query_bot = QueryBot(system_message, model_name=model_name, document_paths=doc_paths)
95103

96104
with PromptRecorder() as recorder:
97105
query = "What is the main idea of document1?"

0 commit comments

Comments
 (0)