Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Replicate streaming API #16597

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Use Replicate streaming API #16597

merged 1 commit into from
Oct 18, 2024

Conversation

RomainGehrig
Copy link
Contributor

Description

The Replicate integration did not use streaming text response as the integration predates v0.21.0.

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

  • Yes
  • No

Type of Change

  • Small breaking change as setups with replicate library < 0.25.2 may not work (and definitively when < 0.21.0).

How Has This Been Tested?

  • I tested the modified integration with versions 0.25.2 (april 2024), 0.34.2 (last version in 0.x), 1.0.2 (newest) and they all stream the text response. Here is the testing code:
import replicate
from llama_index.llms.replicate import Replicate

replicate.default_client._api_token = "<YOUR_API_KEY>"

llm = Replicate(model="meta/meta-llama-3-70b-instruct")
for ev in llm.stream_complete("How are you doing ?"):
    print(ev.delta, end="", flush=True)

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Oct 18, 2024
Copy link
Collaborator

@anoopshrma anoopshrma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks for the contribution!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 18, 2024
@nerdai nerdai merged commit dcf2419 into run-llama:main Oct 18, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants