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

TargetClosedError on search graph scraper. #834

Open
dejoma opened this issue Nov 27, 2024 · 0 comments
Open

TargetClosedError on search graph scraper. #834

dejoma opened this issue Nov 27, 2024 · 0 comments

Comments

@dejoma
Copy link

dejoma commented Nov 27, 2024

Describe the bug

future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
Traceback (most recent call last):
  File "/Users/dejoma/Work/pipelines/.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 518, in wrap_api_call
    return await cb()
           ^^^^^^^^^^
  File "/Users/dejoma/Work/pipelines/.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 85, in inner_send
    callback = self._connection._send_message_to_server(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dejoma/Work/pipelines/.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 322, in _send_message_to_server
    raise self._closed_error
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
Attempt 2 failed: 
Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
Traceback (most recent call last):
  File "/Users/dejoma/Work/pipelines/.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 518, in wrap_api_call
    return await cb()
           ^^^^^^^^^^

Code

SCRAPE_CONFIG = {
    "llm": {
        "api_key": os.environ["TOGETHER_API_KEY"],
        "model": "togetherai/meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
    },
    "verbose": False,
    "headless": True,
    "max_results": 5,
    "search_engine": "duckduckgo",
}
scraper = SearchGraph(prompt=prompt, config=SCRAPE_CONFIG, schema=TocScraperOutput)  # type: ignore
try:
    scrape_results = scraper.run()
    ...

P.S. also there's another bug in the model_tokens.py somewhere I believe:

Model togetherai/meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo not found,
                    using default token size (8192)

so the model is not found in there (max size is 200K); but it still uses the model anyway.

Additional context
Im pretty confident on the search_engine not being related to this, I also had this with the default settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant