Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier committed Dec 20, 2024
1 parent dd6d6dc commit 9666b00
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
57 changes: 29 additions & 28 deletions docs/examples/gallery_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@
Ragna supports streaming responses from the assistant. This example showcases how this
is performed using the Python and REST API.
!!! tip
Of the assistants that Ragna has built in, the following ones support streaming:
- [Anthropic](https://www.anthropic.com/)
- [ragna.assistants.ClaudeOpus][]
- [ragna.assistants.ClaudeSonnet][]
- [ragna.assistants.ClaudeHaiku][]
- [Cohere](https://cohere.com/)
- [ragna.assistants.Command][]
- [ragna.assistants.CommandLight][]
- [Google](https://ai.google.dev/)
- [ragna.assistants.GeminiPro][]
- [ragna.assistants.GeminiUltra][]
- [OpenAI](https://openai.com/)
- [ragna.assistants.Gpt35Turbo16k][]
- [ragna.assistants.Gpt4][]
- [llamafile](https://github.com/Mozilla-Ocho/llamafile)
- [ragna.assistants.LlamafileAssistant][]
- [Ollama](https://ollama.com/)
- [ragna.assistants.OllamaGemma2B][]
- [ragna.assistants.OllamaLlama2][]
- [ragna.assistants.OllamaLlava][]
- [ragna.assistants.OllamaMistral][]
- [ragna.assistants.OllamaMixtral][]
- [ragna.assistants.OllamaOrcaMini][]
- [ragna.assistants.OllamaPhi2][]
"""

# %%
Expand All @@ -11,34 +39,6 @@
# To be able to stream a message from an assistant, it needs to support streaming. For
# this example, we subclass the [ragna.assistants.RagnaDemoAssistant][], split its
# message on whitespace, and return the individual chunks.
#
# !!! tip
#
# Of the assistants that Ragna has built in, the following ones support streaming:
#
# - [Anthropic](https://www.anthropic.com/)
# - [ragna.assistants.ClaudeOpus][]
# - [ragna.assistants.ClaudeSonnet][]
# - [ragna.assistants.ClaudeHaiku][]
# - [Cohere](https://cohere.com/)
# - [ragna.assistants.Command][]
# - [ragna.assistants.CommandLight][]
# - [Google](https://ai.google.dev/)
# - [ragna.assistants.GeminiPro][]
# - [ragna.assistants.GeminiUltra][]
# - [OpenAI](https://openai.com/)
# - [ragna.assistants.Gpt35Turbo16k][]
# - [ragna.assistants.Gpt4][]
# - [llamafile](https://github.com/Mozilla-Ocho/llamafile)
# - [ragna.assistants.LlamafileAssistant][]
# - [Ollama](https://ollama.com/)
# - [ragna.assistants.OllamaGemma2B][]
# - [ragna.assistants.OllamaLlama2][]
# - [ragna.assistants.OllamaLlava][]
# - [ragna.assistants.OllamaMistral][]
# - [ragna.assistants.OllamaMixtral][]
# - [ragna.assistants.OllamaOrcaMini][]
# - [ragna.assistants.OllamaPhi2][]

from ragna import assistants

Expand Down Expand Up @@ -76,6 +76,7 @@ def answer(self, messages):
_ = await chat.prepare()

# %%
# Set the `stream=True` flag when calling [ragna.core.Chat.answer][]

message = await chat.answer("What is Ragna?", stream=True)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Repository = "https://github.com/Quansight/ragna"
[project.optional-dependencies]
# to update the array below, run scripts/update_optional_dependencies.py
all = [
"chromadb>=0.4.13",
"chromadb<=0.5.11,>=0.4.13",
"httpx_sse",
"ijson",
"lancedb>=0.2",
Expand Down

0 comments on commit 9666b00

Please sign in to comment.