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?
I have a fairly basic example. When I run the chain like below, with a custom function, everything is executed.
However, if I add
LLMChain.message_processors([JsonProcessor.new!(~r/```json(.*?)```/s)])just before therunI get an error. If then I remove theadd_toolscall it works again. Maybe the result theadd_toolsfunction is putting on the chain does not work nicely with what theJsonProcessorexpects?