microsoft / azure-openai-service-proxy

The Azure AI proxy service facilitates easy access to Azure AI resources for workshops and hackathons. It offers a Playground-like interface and supports Azure AI SDKs. Access is granted through a time-limited API key and endpoint.
https://microsoft.github.io/azure-openai-service-proxy/
MIT License
61 stars 36 forks source link

Rate limiting needs support in the Playground #135

Closed gloveboxes closed 8 months ago

gloveboxes commented 9 months ago

Two issues:

1) Authentication - atm responses to 401, but also needs to respond to 429 (rate limit exceeded 2) If Rate limit exceeded in an existing logged in session, then then the playground fails to handle the rate limit exceeded and the the playground throws an exception - see details below...

See branch https://github.com/microsoft/azure-openai-service-proxy/tree/rate_limit_exceeded_handling for support of Daily rate limit exceeded support.

All exception messages are now returned from the proxy in the Azure OpenAI format

{ "error": { "code": STATUS_CODE, "message": "MESSAGE" } }

In the playground the following exception is thrown

Unexpected Application Error! Cannot read properties of undefined (reading 'code') TypeError: Cannot read properties of undefined (reading 'code') at createErrorMessage (http://localhost:4280/src/pages/playground/Chat. reducers.ts: 13:22) at reducer (http://localhost:4280/src/pages/playground/Chat. reducers.ts: 66:18) at updateReducer (http://localhost:4280/node_modules/ vite/deps/chunk-XE5K45DR. js?v=ee1623f6:12417:30 ) at Object.useReducer (http://localhost: 4280/node_modules/.vite/deps/chunk-XE5K45DR. js?v=ee1623f6:13360:24) at useReducer (http://localhost: 4280/node_modules/.vite/deps/chunk-NVDSUZN5. js?v=ee1623f6: 1070:29) at Chat (http://localhost:4280/src/pages/playground/Chat.tsx: 36:29) at renderWithHooks (http://localhost:4280/node_modules/. vite/deps/chunk-XE5K45DR. js?v=ee1623f6:12171:26) at updateFunctionComponent (http://localhost:4280/node_modules/.vite/deps/chunk-XE5K45DR. j s?v=ee1623f6:14577:28) at beginwork (http://localhost:4280/node_modules/. vite/deps/chunk-XE5K45DR. js?v=ee1623f6:15912: 22) at beginWork$1 (http://localhost:4280/node_modules/.vite/deps/chunk-XE5K45DR. js?v=ee1623f6:19749:22) § Hey developer . You can provide a way better UX than this when your app throws errors by providing your own ErrorBoundary or errorElement prop on your route.

aaronpowell commented 8 months ago

This will be fixed with #163