A developer is deploying a LangChain agent that uses an LLM from OCI Generative AI. The agent interacts with external APIs and must handle rate limits gracefully. Which TWO practices should the developer implement?
Trap 1: Disable caching to ensure fresh responses
Disabling caching increases the number of API calls, worsening rate limiting issues.
Trap 2: Increase the max_tokens parameter to reduce the number of calls
max_tokens controls response length, not the number of API calls; increasing it does not reduce call frequency.
Trap 3: Set the model temperature to 0
Temperature affects randomness of output, not API call frequency or rate limit handling.
- A
Disable caching to ensure fresh responses
Why wrong: Disabling caching increases the number of API calls, worsening rate limiting issues.
- B
Increase the max_tokens parameter to reduce the number of calls
Why wrong: max_tokens controls response length, not the number of API calls; increasing it does not reduce call frequency.
- C
Implement retry logic with exponential backoff for API calls
Retry with backoff reduces load on the API and allows recovery from transient rate limit errors.
- D
Set the model temperature to 0
Why wrong: Temperature affects randomness of output, not API call frequency or rate limit handling.
- E
Use a rate limiter to control the frequency of API requests
A rate limiter ensures the agent stays within the allowed request rate, preventing throttling.