Skip to content

JsonProcessor does not work with add_tools #213

Description

@jeroenbourgois

I have a fairly basic example. When I run the chain like below, with a custom function, everything is executed.

{:ok, updated_chain, response} =
  %{llm: chat_model, custom_context: context, verbose: true}
  |> LLMChain.new!()
  |> LLMChain.add_messages(messages)
  |> LLMChain.add_tools([function])
  # keep running the LLM chain against the LLM if needed to evaluate
  # function calls and provide a response.
  |> LLMChain.run(mode: :while_needs_response)

However, if I add LLMChain.message_processors([JsonProcessor.new!(~r/```json(.*?)```/s)]) just before the run I get an error. If then I remove the add_tools call it works again. Maybe the result the add_tools function is putting on the chain does not work nicely with what the JsonProcessor expects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions