Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation Message Exception #589

Open
gkapellmann opened this issue Aug 12, 2024 · 4 comments
Open

Conversation Message Exception #589

gkapellmann opened this issue Aug 12, 2024 · 4 comments

Comments

@gkapellmann
Copy link

Hello again,

Following the steps of the documentation, I have configured my LlamaSharp model here:

"LlamaSharp": { "Interactive": true, "ModelDir": "D:/C#/Llms", "DefaultModel": "llama-2-7b-chat.Q4_K_M.gguf", "MaxContextLength": 1024, "NumberOfGpuLayer": 20 },

and in the providers section too:

"LlmProviders": [ { "Provider": "llama-sharp", "Models": [ { "Name": "llama-2-7b-chat.Q4_K_M.gguf", "Type": "chat" } ] } ],

As you can tell, I am only adding Llamasharp, no other provider.

When running the app, my plugins folder remains empty, and when trying to send a message to start the conversation I get an exception:

System.ArgumentNullException: Value cannot be null. (Parameter 'path2')
at System.ArgumentNullException.Throw(String paramName)
at System.IO.Path.Combine(String path1, String path2)
at BotSharp.Plugins.LLamaSharp.LlamaAiModel.LoadModel(String model)
at BotSharp.Plugin.LLamaSharp.Providers.ChatCompletionProvider.GetChatCompletions(Agent agent, List1 conversations) at BotSharp.Core.Routing.RoutingService.InvokeAgent(String agentId, List1 dialogs, Func2 onFunctionExecuting) at BotSharp.Core.Routing.Handlers.RouteToAgentRoutingHandler.Handle(IRoutingService routing, FunctionCallFromLlm inst, RoleDialogModel message, Func2 onFunctionExecuting)
at BotSharp.Core.Routing.RoutingService.InstructDirect(Agent agent, RoleDialogModel message)
at BotSharp.Core.Conversations.Services.ConversationService.SendMessage(String agentId, RoleDialogModel message, PostbackMessageModel replyMessage, Func2 onMessageReceived, Func2 onFunctionExecuting, Func2 onFunctionExecuted) at BotSharp.OpenAPI.Controllers.ConversationController.SendMessage(String agentId, String conversationId, NewMessageModel input) at lambda_method6(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

Seems that it is not finding the provider, am I right? I have added the plugin "BotSharp.Plugin.LLamaSharp", so I have no idea what I could be missing.

@gkapellmann
Copy link
Author

Now trying from home is a different error, but same code:

System.NullReferenceException: Object reference not set to an instance of an object.
at BotSharp.Core.Routing.RoutingService.InvokeAgent(String agentId, List1 dialogs, Func2 onFunctionExecuting)
at BotSharp.Core.Routing.Handlers.RouteToAgentRoutingHandler.Handle(IRoutingService routing, FunctionCallFromLlm inst, RoleDialogModel message, Func2 onFunctionExecuting) at BotSharp.Core.Routing.RoutingService.InstructDirect(Agent agent, RoleDialogModel message) at BotSharp.Core.Conversations.Services.ConversationService.SendMessage(String agentId, RoleDialogModel message, PostbackMessageModel replyMessage, Func2 onMessageReceived, Func2 onFunctionExecuting, Func2 onFunctionExecuted)
at BotSharp.OpenAPI.Controllers.ConversationController.SendMessage(String agentId, String conversationId, NewMessageModel input)
at lambda_method6(Closure, Object)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

This is very weird.

I have added the Router parameter, but is empty in the end, is that correct?

@gkapellmann gkapellmann changed the title Configuration of LlamaSharp Conversation Message Exception Aug 12, 2024
@gkapellmann
Copy link
Author

gkapellmann commented Aug 12, 2024

Ok, figured it out, I had to add the llmConfig to the Agent structure in the settings. It is now like this:

"Agent": {
"DataDir": "agents",
"TemplateFormat": "liquid",
//"HostAgentId": "01e2fc5c-2c89-4ec7-8470-7688608b496c",
//"EnableTranslator": false
"llmConfig": {
"Provider": "llama-sharp",
"Model": "llama-2-7b-chat.Q8_0.gguf",
//"is_inherit": true,
"max_recursion_depth": 3
}
},

But I dont really understand this settings.

  • Are these settings general for all Agents?
  • What is the function of HostAgentId?
  • If I dont fill llmConfig, is there a way to leave a predetermined model? Or is this that way?

Thank you in advance!

@Oceania2018
Copy link
Member

The HostAgentId is the Routing agent entry when you're using the BotSharp-UI.
image

@gkapellmann
Copy link
Author

OK! Thanks for clarifying that @Oceania2018

So if I am not using the UI, but just by API calls, there is really no need of a Hosting agent, I guess??

  • But then, the "Agent" structure setting, those are the generic settings for all agents?
  • What is the default llmConfig value if it is not specified?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants