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

[AI gateway] Request timeouts for fallback providers #19391

Closed
wants to merge 147 commits into from

Conversation

kodster28
Copy link
Contributor

Summary

New feature, request timeouts for fallback providers.

Updated several pages in AI gateway docs + changelog entry.

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.

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

src/content/docs/ai-gateway/providers/universal.mdx Outdated Show resolved Hide resolved
You can use the Universal endpoint to contact every provider. The payload is expecting an array of message, and each message is an object with the following parameters:

- `provider` : the name of the provider you would like to direct this message to. Can be OpenAI, workers-ai, or any of our supported providers.
- `endpoint`: the pathname of the provider API you’re trying to reach. For example, on OpenAI it can be `chat/completions`, and for Workers AI this might be [`@cf/meta/llama-3.1-8b-instruct`](/workers-ai/models/llama-3.1-8b-instruct/). See more in the sections that are specific to [each provider](/ai-gateway/providers/).
- `authorization`: the content of the Authorization HTTP Header that should be used when contacting this provider. This usually starts with “Token” or “Bearer”.
- `headers`:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kathayl, I think this is accurate, but fact check me here :)

Copy link
Contributor

Choose a reason for hiding this comment

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

switched from caching and authentication to caching and custom metadata.

bc authentication is at the level of the request, not provider.

- `query`: the payload as the provider expects it in their official API.

## cURL example

The following example shows a simple setup with a primary model and a [fallback](/ai-gateway/configuration/fallbacks/) option.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wanted to add more cross-links over to fallbacks page

@@ -41,6 +41,10 @@ entries:
general_definition: |-
Header to [bypass caching for a specific request](/ai-gateway/configuration/caching/#skip-cache-cf-aig-skip-cache).

- term: cf-aig-request-timeout
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adds automatically to headers glossary page

kodster28 and others added 2 commits January 23, 2025 13:50
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
@github-actions github-actions bot added product:ai-gateway AI Gateway: https://developers.cloudflare.com/ai-gateway/ size/m labels Jan 23, 2025
Copy link

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

Deploying cloudflare-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: a8eaae8
Status: ✅  Deploy successful!
Preview URL: https://d798ed22.cloudflare-docs-7ou.pages.dev
Branch Preview URL: https://aig-request-timeout.cloudflare-docs-7ou.pages.dev

View logs

Copy link

github-actions bot commented Jan 23, 2025

Files with changes (up to 15)

Original Link Updated Link
https://developers.cloudflare.com/agents/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/agents/
https://developers.cloudflare.com/developer-spotlight/tutorials/fullstack-authentication-with-next-js-and-cloudflare-d1/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/developer-spotlight/tutorials/fullstack-authentication-with-next-js-and-cloudflare-d1/
https://developers.cloudflare.com/support/troubleshooting/http-status-codes/4xx-client-error/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/support/troubleshooting/http-status-codes/4xx-client-error/
https://developers.cloudflare.com/workers-ai/tutorials/explore-workers-ai-models-using-a-jupyter-notebook/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/workers-ai/tutorials/explore-workers-ai-models-using-a-jupyter-notebook/
https://developers.cloudflare.com/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/
https://developers.cloudflare.com/workers/wrangler/commands/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/workers/wrangler/commands/
https://developers.cloudflare.com/magic-wan/configuration/manually/third-party/azure/azure-virtual-wan/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/magic-wan/configuration/manually/third-party/azure/azure-virtual-wan/
https://developers.cloudflare.com/fundamentals/api/how-to/make-api-calls/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/fundamentals/api/how-to/make-api-calls/
https://developers.cloudflare.com/pages/configuration/git-integration/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/pages/configuration/git-integration/
https://developers.cloudflare.com/turnstile/tutorials/excluding-turnstile-from-e2e-tests/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/turnstile/tutorials/excluding-turnstile-from-e2e-tests/
https://developers.cloudflare.com/calls/turn/faq/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/calls/turn/faq/
https://developers.cloudflare.com/ai-gateway/integrations/worker-binding-methods/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/ai-gateway/integrations/worker-binding-methods/
https://developers.cloudflare.com/pages/functions/wrangler-configuration/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/pages/functions/wrangler-configuration/
https://developers.cloudflare.com/fundamentals/reference/http-headers/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/fundamentals/reference/http-headers/
https://developers.cloudflare.com/fundamentals/api/how-to/create-via-api/ https://aig-request-timeout.cloudflare-docs-7ou.pages.dev/fundamentals/api/how-to/create-via-api/

kathayl and others added 12 commits January 27, 2025 13:30
Makes the `skip_region_validation = true` and related options clearer.
* Use 'Cloudflare origin CA' more consistently and callout proxied traffic

* Create origin-ca folder and add placeholder page for ts

* Create partial for pause CF error

* Add NET::ERR_CERT_AUTHORITY_INVALID and solutions

* Add origin server errors and list necessary root CA files

* Fix missing period

Co-authored-by: Pedro Sousa <[email protected]>

* Reword troubleshooting steps for proxying on and off

---------

Co-authored-by: Pedro Sousa <[email protected]>
* Feature nodejs compat issues in troubleshooting

* thomasgauvin: fix formatting on hyperdrive nodejs errors troubleshooting page

* thomasgauvin: nit
@github-actions github-actions bot added product:images Related to Image Resizing product product:kv product:learning-paths product:load-balancing Related to Load Balancing product product:logs Related to Logs product:magic-transit product:magic-wan product:network product:page-shield Issues or PRs related to Page Shield product:pages product:pub-sub Pub/Sub: https://developers.cloudflare.com/pub-sub product:queues Cloudflare Queues: https://developers.cloudflare.com/queues product:r2 R2 object storage: https://developers.cloudflare.com/r2 product:radar product:reference-architecture product:rules Related to rules product:ruleset-engine product:ssl Related to SSL product:style-guide product:support product:terraform Related to Terraform product product:turnstile product:vectorize Vectorize: https://developers.cloudflare.com/vectorize/ product:waf product:workers Related to Workers product product:workers-ai Workers AI: https://developers.cloudflare.com/workers-ai/ product:workflows Workflows: https://developers.cloudflare.com/workflows/ size/xl and removed size/m labels Jan 30, 2025
@kodster28 kodster28 closed this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product:agents product:ai-gateway AI Gateway: https://developers.cloudflare.com/ai-gateway/ product:analytics Related to Analytics product product:api-shield product:bots Related to Bots product product:browser-rendering product:byoip Related to BYOIP product:cache Issues or PRs related to Cache product:calls product:cloudflare-for-platforms product:cloudflare-one product:constellation product:d1 D1: https://developers.cloudflare.com/d1/ product:data-localization product:ddos-protection product:developer-spotlight product:dns Issues or PRs related to DNS product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ product:email-routing product:email-security product:fundamentals product:hyperdrive Hyperdrive: https://developers.cloudflare.com/hyperdrive/ product:images Related to Image Resizing product product:kv product:learning-paths product:load-balancing Related to Load Balancing product product:logs Related to Logs product:magic-transit product:magic-wan product:network product:page-shield Issues or PRs related to Page Shield product:pages product:pub-sub Pub/Sub: https://developers.cloudflare.com/pub-sub product:queues Cloudflare Queues: https://developers.cloudflare.com/queues product:r2 R2 object storage: https://developers.cloudflare.com/r2 product:radar product:reference-architecture product:rules Related to rules product:ruleset-engine product:ssl Related to SSL product:style-guide product:support product:terraform Related to Terraform product product:turnstile product:vectorize Vectorize: https://developers.cloudflare.com/vectorize/ product:waf product:workers Related to Workers product product:workers-ai Workers AI: https://developers.cloudflare.com/workers-ai/ product:workflows Workflows: https://developers.cloudflare.com/workflows/ product:1.1.1.1 Related to 1.1.1.1 product size/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.