jupyterlab / jupyter-ai

A generative AI extension for JupyterLab
https://jupyter-ai.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
3.02k stars 299 forks source link

gpt4all does not generate notebook (using /generate) #787

Open xhejtman opened 2 months ago

xhejtman commented 2 months ago

Description

trying to generate an example notebook throws error:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/site-packages/jupyter_ai/chat_handlers/base.py", line 125, in on_message
    await self.process_message(message)
  File "/opt/conda/lib/python3.11/site-packages/jupyter_ai/chat_handlers/generate.py", line 279, in process_message
    final_path = await self._generate_notebook(prompt=message.body)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/jupyter_ai/chat_handlers/generate.py", line 255, in _generate_notebook
    outline = await generate_outline(prompt, llm=self.llm, verbose=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/jupyter_ai/chat_handlers/generate.py", line 59, in generate_outline
    outline = parser.parse(outline)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/langchain_core/output_parsers/pydantic.py", line 64, in parse
    return super().parse(text)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/langchain_core/output_parsers/json.py", line 72, in parse
    return self.parse_result([Generation(text=text)])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/langchain_core/output_parsers/pydantic.py", line 60, in parse_result
    json_object = super().parse_result(result)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/langchain_core/output_parsers/json.py", line 69, in parse_result
    raise OutputParserException(msg, llm_output=text) from e
langchain_core.exceptions.OutputParserException: Invalid json output: The outline should be organized into sections with headings indicating their content. Each section should have at least one subsection.

clearly returing the text: The outline should be organized into sections with headings indicating their content. Each section should have at least one subsection. instead of JSON.

Using model: nous-hermes-llama2-13b.Q4_0.gguf

packages:

gpt4all                   2.6.0                    pypi_0    pypi
langchain                 0.1.20                   pypi_0    pypi
langchain-community       0.0.38                   pypi_0    pypi
langchain-core            0.1.52                   pypi_0    pypi
langchain-openai          0.1.7                    pypi_0    pypi
langchain-text-splitters  0.0.2                    pypi_0    pypi
langsmith                 0.1.59                   pypi_0    pypi
jupyter-ai                2.15.0                   pypi_0    pypi
jupyter-ai-magics         2.15.0                   pypi_0    pypi
jupyterlab                4.0.7              pyhd8ed1ab_0    conda-forge
welcome[bot] commented 2 months ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: