autodoc
autodoc copied to clipboard
When Indexing, [TOO MANY REQUESTS] Keeps being thrown
Indexing as usual, after estimation, it runs for a bit then keeps throwing this error:
Failed to get summary for file github.py
⠹ Processing 724 files...Error: Request failed with status code 429
at createError (file:///home/bewinxed/.nvm/versions/node/v18.15.0/lib/node_modules/@context-labs/autodoc/node_modules/langchain/dist/util/axios-fetch-adapter.js:302:19)
at settle (file:///home/bewinxed/.nvm/versions/node/v18.15.0/lib/node_modules/@context-labs/autodoc/node_modules/langchain/dist/util/axios-fetch-adapter.js:24:16)
at file:///home/bewinxed/.nvm/versions/node/v18.15.0/lib/node_modules/@context-labs/autodoc/node_modules/langchain/dist/util/axios-fetch-adapter.js:185:19
at new Promise (<anonymous>)
at fetchAdapter (file:///home/bewinxed/.nvm/versions/node/v18.15.0/lib/node_modules/@context-labs/autodoc/node_modules/langchain/dist/util/axios-fetch-adapter.js:177:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [AsyncFunction: fetchAdapter],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
headers: {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
'User-Agent': 'OpenAI/NodeJS/3.2.1',
Authorization: 'Bearer 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'
},
method: 'post',
data: '{"model":"gpt-3.5-turbo","temperature":0.1,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"n":1,"stream":false,"messages":[{"role":"user","content":"\\n You are acting as a code documentation expert for a project called RADAR.\\n Below is the code from a file located at `RADAR`. \\n Write a detailed technical explanation of what this code does. \\n Focus on the high-level purpose of the code and how it may be used in the larger project.\\n Include code examples where appropriate. Keep you response between 100 and 300 words. \\n DO NOT RETURN MORE THAN 300 WORDS.\\n Output should be in markdown format. \\n Do not say \\"this file is a part of the RADAR project\\".\\n Do not just list the methods and classes in this file.\\n\\n Code:\\n import json\\nfrom fastapi.encoders import jsonable_encoder\\nfrom typing import Optional\\nimport aiohttp\\nfrom fastapi import APIRouter, Query, Response\\n\\nfrom utils.lunaris import Lunaris\\n\\nAPI_KEY = \\"819a8443-a2fb-433f-83cd-7a47257bd548\\"\\n\\nrouter = APIRouter()\\n\\n\\[email protected](\\"/collection/find\\")\\nasync def find_collection_post(\\n helloMoonCollectionId: str = None,\\n collectionName: str = None,\\n):\\n if all([helloMoonCollectionId, collectionName]):\\n raise Exception(\\n \\"You can only provide one of helloMoonCollectionId or collectionName\\"\\n )\\n if not any([helloMoonCollectionId, collectionName]):\\n raise Exception(\\n \\"You must provide either helloMoonCollectionId or collectionName\\"\\n )\\n return await Lunaris().find_collection(\\n helloMoonCollectionId=helloMoonCollectionId, collectionName=collectionName\\n )\\n\\n\\n Response:\\n\\n "}]}',
url: 'https://api.openai.com/v1/chat/completions'
},
request: Request {
[Symbol(realm)]: { settingsObject: [Object] },
[Symbol(state)]: {
method: 'POST',
localURLsOnly: false,
unsafeRequest: false,
body: [Object],
client: [Object],
reservedClient: null,
replacesClientId: '',
window: 'client',
keepalive: false,
serviceWorkers: 'all',
initiator: '',
destination: '',
priority: null,
origin: 'client',
policyContainer: 'client',
referrer: 'client',
referrerPolicy: '',
mode: 'cors',
useCORSPreflightFlag: false,
credentials: 'same-origin',
useCredentials: false,
cache: 'default',
redirect: 'follow',
integrity: '',
cryptoGraphicsNonceMetadata: '',
parserMetadata: '',
reloadNavigation: false,
historyNavigation: false,
userActivation: false,
taintedOrigin: false,
redirectCount: 0,
responseTainting: 'basic',
preventNoCacheCacheControlHeaderModification: false,
done: false,
timingAllowFailed: false,
headersList: [HeadersList],
urlList: [Array],
url: [URL]
},
[Symbol(signal)]: AbortSignal { aborted: false },
[Symbol(headers)]: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
}
},
response: {
ok: false,
status: 429,
statusText: 'Too Many Requests',
headers: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
},
config: {
transitional: [Object],
adapter: [AsyncFunction: fetchAdapter],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
headers: [Object],
method: 'post',
data: '{"model":"gpt-3.5-turbo","temperature":0.1,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"n":1,"stream":false,"messages":[{"role":"user","content":"\\n You are acting as a code documentation expert for a project called RADAR.\\n Below is the code from a file located at `RADAR`. \\n Write a detailed technical explanation of what this code does. \\n Focus on the high-level purpose of the code and how it may be used in the larger project.\\n Include code examples where appropriate. Keep you response between 100 and 300 words. \\n DO NOT RETURN MORE THAN 300 WORDS.\\n Output should be in markdown format. \\n Do not say \\"this file is a part of the RADAR project\\".\\n Do not just list the methods and classes in this file.\\n\\n Code:\\n import json\\nfrom fastapi.encoders import jsonable_encoder\\nfrom typing import Optional\\nimport aiohttp\\nfrom fastapi import APIRouter, Query, Response\\n\\nfrom utils.lunaris import Lunaris\\n\\nAPI_KEY = \\"819a8443-a2fb-433f-83cd-7a47257bd548\\"\\n\\nrouter = APIRouter()\\n\\n\\[email protected](\\"/collection/find\\")\\nasync def find_collection_post(\\n helloMoonCollectionId: str = None,\\n collectionName: str = None,\\n):\\n if all([helloMoonCollectionId, collectionName]):\\n raise Exception(\\n \\"You can only provide one of helloMoonCollectionId or collectionName\\"\\n )\\n if not any([helloMoonCollectionId, collectionName]):\\n raise Exception(\\n \\"You must provide either helloMoonCollectionId or collectionName\\"\\n )\\n return await Lunaris().find_collection(\\n helloMoonCollectionId=helloMoonCollectionId, collectionName=collectionName\\n )\\n\\n\\n Response:\\n\\n "}]}',
url: 'https://api.openai.com/v1/chat/completions'
},
request: Request {
[Symbol(realm)]: [Object],
[Symbol(state)]: [Object],
[Symbol(signal)]: [AbortSignal],
[Symbol(headers)]: [HeadersList]
},
data: { error: [Object] }
},
isAxiosError: true,
toJSO
Just got this email from openAI
Hi there,
Your OpenAI API key was determined to have been leaked, which has triggered a key rotation and this friendly notification email.
This may be because you committed your API key to an online service such as GitHub, or your key may have been compromised in another way.
Don't worry, you still have API access! Head over to the [API Keys](https://mandrillapp.com/track/click/31165340/platform.openai.com?p=eyJzIjoiaV9DU0RkMFdkQkg1cUJRQlVQdmJGWTRCZmI4IiwidiI6MSwicCI6IntcInVcIjozMTE2NTM0MCxcInZcIjoxLFwidXJsXCI6XCJodHRwczpcXFwvXFxcL3BsYXRmb3JtLm9wZW5haS5jb21cXFwvYWNjb3VudFxcXC9hcGkta2V5c1wiLFwiaWRcIjpcIjg2YmU5MTMwZDNhYTRlZWNiMjZlNDljNTA3ZDljZTQzXCIsXCJ1cmxfaWRzXCI6W1wiZGRlMTIyMmY1ZjBmNGVlOWEwNGY2NzdkZDQ2N2ZjN2MyNTllN2U4MFwiXX0ifQ) page to view your updated API key.
If your API key was stored in any locations - for instance, in code you are running - it will need to be updated before you can run this code again.
Finally, we ask that you please review our [best practices for API key safety](https://mandrillapp.com/track/click/31165340/help.openai.com?p=eyJzIjoiNUhhYkNXSWxjS25Gd01sakxNWExUTFJYYUlZIiwidiI6MSwicCI6IntcInVcIjozMTE2NTM0MCxcInZcIjoxLFwidXJsXCI6XCJodHRwczpcXFwvXFxcL2hlbHAub3BlbmFpLmNvbVxcXC9lblxcXC9hcnRpY2xlc1xcXC81MTEyNTk1LWJlc3QtcHJhY3RpY2VzLWZvci1hcGkta2V5LXNhZmV0eVwiLFwiaWRcIjpcIjg2YmU5MTMwZDNhYTRlZWNiMjZlNDljNTA3ZDljZTQzXCIsXCJ1cmxfaWRzXCI6W1wiNzI4ODA0ZmM5MzY4OWEyZTk2MDE2ZDNhYzYyZjhmZGY0MTc5MGJkOVwiXX0ifQ).
Best,
The OpenAI team
You're hitting up against the maximum number of requests that OpenAI allows. This can happen in large projects.
We'll be adding improvements to handle this more gracefully in the near future.
Edit: your open AI key is viewable in the terminal output you posted. You should delete your post and rotate your key immediately.
No way to throttle it to go sequentially?
On Sat, 25 Mar 2023 at 4:36 PM Sam Hogan @.***> wrote:
You're hitting up again the maximum number of requests that OpenAI allows. This can happen in large projects.
We'll be adding improvements to handle this more gracefully in the near future.
— Reply to this email directly, view it on GitHub https://github.com/context-labs/autodoc/issues/6#issuecomment-1483827174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFY5BM2TMXXYXBNHO5PQU3W53YETANCNFSM6AAAAAAWHRFTFE . You are receiving this because you authored the thread.Message ID: @.***>
Sequentially would take a very long time for large projects using slower models.
Right now we parallelize up to 25 requests at a time but it's not perfect. Checkout RateLimit.ts in the project for more info.
If you can improve this, I'll merge it right away.
I face this issue even for smaller projects; how can this be solved?
https://github.com/Prem95/DataSciencePortfolio was my test attempt
I was getting this error immediately on a pretty small repository (136 files). I changed APIRateLimit manually (this.maxConcurrentCalls = 1;) and managed to index all files, though it took a few minutes.
Thanks for the tip! This is what I'm looking for.
On Wed, 29 Mar 2023 at 8:05 PM Nilo Silva @.***> wrote:
I was getting this error immediately on a pretty small repository (136 files). I changed APIRateLimit manually (this.maxConcurrentCalls = 1;) and managed to index all files, though it took a few minutes.
— Reply to this email directly, view it on GitHub https://github.com/context-labs/autodoc/issues/6#issuecomment-1488978514, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFY5BLOWOSHDG56JF2SHHLW6RTT3ANCNFSM6AAAAAAWHRFTFE . You are receiving this because you authored the thread.Message ID: @.***>
I was getting this error immediately on a pretty small repository (136 files). I changed
APIRateLimitmanually (this.maxConcurrentCalls = 1;) and managed to index all files, though it took a few minutes.
where exactly I should change this? currently it is 50
where exactly I should change this? currently it is 50
node_modules/@context-labs/autodoc/dist/cli/utils/APIRateLimit.js
Just remove the parameter and set this.maxConcurrentCalls directly
where exactly I should change this? currently it is 50
node_modules/@context-labs/autodoc/dist/cli/utils/APIRateLimit.jsJust remove the parameter and setthis.maxConcurrentCallsdirectly
Even after adding the line, i still get
response: { ok: false, status: 429, statusText: 'Too Many Requests', headers: HeadersList { [Symbol(headers map)]: [Map], [Symbol(headers map sorted)]: null },,
Unsure what the issue is
https://github.com/context-labs/autodoc/issues/6#issuecomment-1488978514
The problem with that is we need to built autodoc from source, we should let this value be configurable from the .autodoc config
@ALL After switching to a pay as you go api key from a free trail api key, I am able to bypass this 429 rate limit error. But this error might still affect us all if OpenAI changes its rate limit
And here is OpenAI guide to implement rate throttle based on your manully set limit : https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb
Yes it is recommended to have a paid OpenAI account with GPT-4 access to use autodoc.