Skip to content

Commit

Permalink
docs: Fixed Conversational RAG README (#199)
Browse files Browse the repository at this point in the history
* docs: README for RAG

* docs: Added link
  • Loading branch information
Josephasafg committed Aug 7, 2024
1 parent 38430ad commit e20978a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [AI21 Official Documentation](#Documentation)
- [Installation](#Installation) 💿
- [Usage - Chat Completions](#Usage)
- [Conversational RAG (Beta)](#Conversational-RAG-Beta)
- [Older Models Support Usage](#Older-Models-Support-Usage)
- [More Models](#More-Models)
- [Streaming](#Streaming)
Expand Down Expand Up @@ -332,19 +333,22 @@ Like chat, but with the ability to retrieve information from your Studio library

```python
from ai21 import AI21Client
from ai21.models import ChatMessage
from ai21.models.chat import ChatMessage

messages = [
ChatMessage(text="Hey", role="user"),
ChatMessage(text="Hi Alice, How can I help you today?", role="assistant"),
ChatMessage(text="How long do deposit holds typically last?", role="user"),
ChatMessage(content="Ask a question about your files", role="user"),
]

client = AI21Client()

client.library.files.create(
file_path="path/to/file",
path="path/to/file/in/library",
labels=["my_file_label"],
)
chat_response = client.beta.conversational_rag.create(
messages=messages,
# you may add file IDs from your studio library in order to question the model about their content
# file_ids=[]
labels=["my_file_label"],
)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def delete_file(client: AsyncAI21Client, file_id: str):


async def main():
ai21_client = AsyncAI21Client(api_key="K8bU2iQWW0aqkUZwHdnFYgxjmMlge7QF")
ai21_client = AsyncAI21Client()

file_id = await upload_file(ai21_client)

Expand Down
2 changes: 1 addition & 1 deletion examples/studio/conversational_rag/conversational_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def delete_file(client: AI21Client, file_id: str):


def main():
ai21_client = AI21Client(api_key="K8bU2iQWW0aqkUZwHdnFYgxjmMlge7QF")
ai21_client = AI21Client()

file_id = upload_file(ai21_client)

Expand Down

0 comments on commit e20978a

Please sign in to comment.