assafelovic / gpt-researcher

GPT based autonomous agent that does online comprehensive research on any given topic
https://gptr.dev
MIT License
13.05k stars 1.61k forks source link

extract_headers sometimes fails #520

Open barsuna opened 1 month ago

barsuna commented 1 month ago

When testing gpt-researcher with local llama3, i found that sometimes the extract_headers will throw the exception here

        if line.startswith("<h") and len(line) > 1:  # Check if the line starts with an HTML header tag
            level = int(line[2])  # Extract header level

apparently sometimes what comes after <h is not a number

temporarily i've changed it to

            try:
                level = int(line[2])  # Extract header level
            except:
                level = 2

but perhaps maintainer of this, can probably fix it properly

arsaboo commented 1 month ago

How are you using llama3 with GPT researcher?

barsuna commented 1 month ago

there was a post here https://github.com/assafelovic/gpt-researcher/issues/395

i'm using a small api gateway that translates gpt-researcher api calls to llama.cpp own apis and does some other general maintenance of the api outputs. lm-studio + ollama can be done without code changes (discounting my other issues) the api gateway requires other changes to gpt-researcher, so i would not recommend it