Skip to content

Conversation

@daisyfaithauma
Copy link
Contributor

Summary

Streaming docs on getting started

Screenshots (optional)

Documentation checklist

  • The documentation style guide has been adhered to.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
  • Files which have changed name or location have been allocated redirects.

@github-actions github-actions bot added the product:workers-ai Workers AI: https://developers.cloudflare.com/workers-ai/ label Jan 6, 2025
@github-actions github-actions bot added the size/s label Jan 6, 2025
Copy link
Contributor

@hyperlint-ai hyperlint-ai bot left a comment

Choose a reason for hiding this comment

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

1 files reviewed, 1 total issue(s) found.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 6, 2025

Deploying cloudflare-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 163c83c
Status: ✅  Deploy successful!
Preview URL: https://a4d7c67b.cloudflare-docs-7ou.pages.dev
Branch Preview URL: https://workers-ai-streaming.cloudflare-docs-7ou.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2025

Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
Copy link
Contributor

@craigsdennis craigsdennis left a comment

Choose a reason for hiding this comment

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

As long as this has been tested, it LGTM!

};
```

The above code can be easily integrated into simple HTML pages or complex SPAs using frameworks like React, Angular, or Vue. For example, in React, you can manage the `EventSource` connection in a `useEffect` hook and update the state incrementally as data is streamed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Strike easily here.

You can also use streaming directly within a Cloudflare Worker:

```javascript
import { Ai } from "@cloudflare/ai";
Copy link
Contributor

Choose a reason for hiding this comment

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

Not anymore


```bash
curl -X POST \
"https://api.cloudflare.com/client/v4/accounts/<account>/ai/run/@cf/meta/llama-2-7b-chat-int8" \
Copy link
Contributor

Choose a reason for hiding this comment

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

Update models?

@daisyfaithauma
Copy link
Contributor Author

Streaming has been moved to particular models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers-ai Workers AI: https://developers.cloudflare.com/workers-ai/ size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants