AI Web Agent avatar
AI Web Agent
Try for free

No credit card required

View all Actors
AI Web Agent

AI Web Agent

apify/ai-web-agent
Try for free

No credit card required

Use natural language prompts to browse the web, click on elements, fill and submit forms, extract data, and take screenshots using the OpenAI API.

User avatar

Exceeding maximum context length will crash the flow

Open

petrvecera opened this issue
5 months ago

When the AI web crawler finds a website which is bigger (html most likely) than the window which is allowed on the Open AI - it will just crash.

What we would expect is no crash, the data should be capped. Maybe just warning that the data are lowered.

Thank you

2023-11-30T16:09:50.188Z file:///home/myuser/node_modules/openai/error.mjs:31 2023-11-30T16:09:50.191Z return new BadRequestError(status, error, message, headers); 2023-11-30T16:09:50.192Z ^ 2023-11-30T16:09:50.194Z 2023-11-30T16:09:50.196Z BadRequestError: This model's maximum context length is 16385 tokens. However, your messages resulted in 18178 tokens (17820 in the messages, 358 in the functions). Please reduce the length of the messages or functions. 2023-11-30T16:09:50.198Z at APIError.generate (file:///home/myuser/node_modules/openai/error.mjs:31:14) 2023-11-30T16:09:50.199Z at OpenAI.makeStatusError (file:///home/myuser/node_modules/openai/core.mjs:263:21) 2023-11-30T16:09:50.201Z at OpenAI.makeRequest (file:///home/myuser/node_modules/openai/core.mjs:303:24) 2023-11-30T16:09:50.203Z at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2023-11-30T16:09:50.204Z at async file:///home/myuser/node_modules/langchain/dist/chat_models/openai.js:514:29 2023-11-30T16:09:50.206Z at async RetryOperation._fn (/home/myuser/node_modules/p-retry/index.js:50:12) { 2023-11-30T16:09:50.207Z status: 400,

User avatar

Hi, thank you for reaching out, we will check it out and let you know.

User avatar

Hi again, we will adjust the status message on this one, so it's clear that the maximum content length was reached on a first look. Thanks for pointing it out. I will keep the issue opened till it's ready.

User avatar

petrvecera

3 months ago

Hi, I think the issue is not the "error message" but the crash of the agent. It can't continue. If I am not wrong I can't affect the length of the content length right? I think the right solution would be to "cut" the content and throw warning that content was cut short.

User avatar

Hi, thanks for the comment, we'll take a look at it. Unfortunately it's not a top priority at the moment, but once someone gets back to it, we'll let you know.

Developer
Maintained by Apify
Actor metrics
  • 107 monthly users
  • 45.0% runs succeeded
  • 14.2 days response time
  • Created in Oct 2023
  • Modified 6 months ago
Categories