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

tokens_per_minute seem not to reflect in engine #367

Open
eyast opened this issue Jul 5, 2024 · 5 comments
Open

tokens_per_minute seem not to reflect in engine #367

eyast opened this issue Jul 5, 2024 · 5 comments
Labels
bug Something isn't working fixed High Priority! High Priority Items!

Comments

@eyast
Copy link

eyast commented Jul 5, 2024

The configuration of tokens_per_minutes in settings.yaml seems not to be adapted by the indexing engine. I've tried setting it to both 50000 and 50_000 (as per the commented example) but I see the same outcome in index-engine.log = 0.
I repeatedly hit 429s, no matter what I do.

The content of settings.yaml:

llm:
  api_key: ${GRAPHRAG_API_KEY}
  type: azure_openai_chat # or azure_openai_chat
  model: gpt-4o
  model_supports_json: true # recommended if this is available for your model.
  # max_tokens: 4000
  # request_timeout: 180.0
  api_base: https://redacted.openai.azure.com/
  api_version: 2024-02-15-preview
  # organization: <organization_id>
  deployment_name: gpt4o
  tokens_per_minute: 50000 # set a leaky bucket throttle
  # requests_per_minute: 20 # set a leaky bucket throttle
  # max_retries: 10
  # max_retry_wait: 10.0
  sleep_on_rate_limit_recommendation: true # whether to sleep when azure suggests wait-times
  # concurrent_requests: 25 # the number of parallel inflight requests that may be made

contents of {run_id}\reports\index-engine.log:

    "llm": {
        "api_key": "REDACTED, length 32",
        "type": "azure_openai_chat",
        "model": "gpt-4o",
        "max_tokens": 4000,
        "request_timeout": 180.0,
        "api_base": "https://redacted.openai.azure.com/",
        "api_version": "2024-02-15-preview",
        "proxy": null,
        "cognitive_services_endpoint": null,
        "deployment_name": "gpt4o",
        "model_supports_json": true,
        "tokens_per_minute": 0,
        "requests_per_minute": 0,
        "max_retries": 10,
        "max_retry_wait": 10.0,
        "sleep_on_rate_limit_recommendation": true,
        "concurrent_requests": 25
    },
    "parallelization": {
        "stagger": 0.3,
        "num_threads": 50
    },
@eyast
Copy link
Author

eyast commented Jul 5, 2024

it seems this problem only occurs for llm.tokens_per_minutes but not for embeddings.llm.tokens_per_minutes - the setting of the latter is properly reflected in the indexlog.

@eyast
Copy link
Author

eyast commented Jul 5, 2024

It seems that no matter what I enter, the value that is leveraged by the index engine is the hardcoded one in configs\defaults.py in LLM_TOKENS_PER_MINUTE.
To prove so, I commented this line - Pydantic would complain that tokens_per_minute is not int, because it's None.

or base.tokens_per_minute,

@jgbradley1 jgbradley1 added High Priority! High Priority Items! bug Something isn't working labels Jul 5, 2024
@KylinMountain
Copy link
Contributor

I find update it to tpm and rpm in setting.yaml will work.

@eyast
Copy link
Author

eyast commented Jul 5, 2024

thanks for the tip - but it seemed strange because the same key is used for llm.embeddings.tokens_per_minute and that seems to be working fine.

@AlonsoGuevara
Copy link
Contributor

Hi folks!

Thanks for following up on this and providing workarounds. This has been fixed in #373
Will include it a part of the next version release, in the meantime, if you use the source directly please pull from latest main to address this.

Will leave the issue open until we release the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed High Priority! High Priority Items!
Projects
None yet
Development

No branches or pull requests

4 participants