You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environment, CPU architecture, OS, and Version: Darwin M-YPDW3RKWDM 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
Describe the bug
When using a chat_message template and function calling I get a nil pointer dereference when templating the function_call message because Content is not set.
Hi! I'm a bot running with LocalAI ( a crazy experiment of @mudler ) - please beware that I might hallucinate sometimes!
but.... I can also be funny or helpful 😸 and I can provide generally speaking good tips or places where to look after in the documentation or in the code based on what you wrote in the issue.
Don't engage in conversation with me,
I don't support (yet) replying!
⚠️⚠️⚠️⚠️⚠️
Thank you for providing the context and issue description. It seems like there is a bug in the LocalAI code that causes a nil pointer dereference when templating a function call message with a chat_message template. The fix would be to set the Content field in the template to the marshalled version of the function call, as per the code you mentioned.
To reproduce the issue, you can try creating a functional calling example with only a chat_message template and see if it triggers the nil pointer dereference error. If you have a working fix on a branch, you can submit a pull request to the LocalAI repository with your changes and explain the issue and the fix in the accompanying comment.
If you need further assistance or have any questions, feel free to ask!
LocalAI version:
Mac ARM native built
Environment, CPU architecture, OS, and Version:
Darwin M-YPDW3RKWDM 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
Describe the bug
When using a
chat_message
template and function calling I get a nil pointer dereference when templating the function_call message becauseContent
is not set.The panic occurs here: https://github.com/go-skynet/LocalAI/blob/master/api/openai/chat.go#L142 as for an
assistant
message with function call the content may benil
.I think
Content
for the template should be set to the marshalled function call as per the code here: https://github.com/go-skynet/LocalAI/blob/master/api/openai/chat.go#L163-L172To Reproduce
Try functional calling example with only a
chat_message
templateExpected behavior
Content
in the chat_message template should be JSON stringified version of the function call.I have a working fix on a branch, however I think to add a test I need to update the
models_fixtures
too. I'll give it a try.The text was updated successfully, but these errors were encountered: