SciSharp / BotSharp

The AI Agent Framework in .NET
https://botsharp.readthedocs.io
Apache License 2.0
2.04k stars 422 forks source link

System.InvalidOperationException While Creating An Agent #79

Closed ugurkaancalim closed 10 months ago

ugurkaancalim commented 12 months ago

Hi there,

I created a c# web api and added botsharp.core and botsharp.abstraction nuget packages to it. I established jwt authorization.

When I try to create an agent, I get this error below:

**System.InvalidOperationException: Unable to resolve service for type 'BotSharp.Abstraction.Agents.IAgentService' while attempting to activate 'BotSharp.Core.Agents.AgentController'. at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired) at lambda_method13(Closure, IServiceProvider, Object[]) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>cDisplayClass6_0.gCreateController|0(ControllerContext controllerContext) 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.gAwaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|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.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

HEADERS

Accept: / Connection: keep-alive Host: localhost:7191 User-Agent: PostmanRuntime/7.32.3 Accept-Encoding: gzip, deflate, br Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjBkNjA0ZGVkLTgwM2UtNGM4YS1iZTg2LThhZWMzYzgwZWFhMCIsInN1YiI6InN1YmIiLCJlbWFpbCI6ImVtYWlsIiwianRpIjoiZDg4MjlkZGItMjFjNy00NWE2LTk0M2ItMGE1YjEzMzFhZDFhIiwicm9sZSI6IlVzZXIiLCJuYmYiOjE2ODc1MzAzOTAsImV4cCI6MTY4NzUzMzk5MCwiaWF0IjoxNjg3NTMwMzkwLCJpc3MiOiJodHRwczovL3d3dy5rZS5jb20iLCJhdWQiOiJodHRwczovL3d3dy5rZS5jb20ifQ.2_lAdI4dKJrqg88XITSxrum9MRqdPmw4OU5n25gloFQb8iBnrV9i6_J7CiBfniUEENCicUK2u-vdKkjPuuvV2Q Content-Type: application/json Content-Length: 50 Postman-Token: 87172b36-cad6-400e-abdd-345e6b29a142**

Can anyone help me

Oceania2018 commented 12 months ago

Compare with this Web Project, it seems like missing the implementation for IAgentService.

ugurkaancalim commented 11 months ago

Hi,

I used Web Project and downloaded "crawl-300d-2M-subword.bin." everything works fine but when I tried to use POST Knowledge API endpoint, I see that the application uses Qdrant and OpenAI to create completion. I don't want to use any 3rd party library or service to make an app. Does Botsharp provide ML algorithms to make a chatbot without using 3rd party services. I have a dataset like below and I want to train a model with it. Is it possible? If yes, how can I do that. Thank you for your help.

{intents:[
    {
    "tag":"greeting",
    "input":["hello","hi"],
    "responses":["I'm fine","Thank you","I'm doing well"]
    },
    ...
]}
Oceania2018 commented 11 months ago

crawl-300d-2M-subword.bin can be downloaded from https://dl.fbaipublicfiles.com/fasttext/vectors-english/crawl-300d-2M-subword.zip This model is used when generate the vector for your text. There are many ways to get the vector, fasttext is the default approach consider about the applicatoin and model performance tradeoff.

Qdrant is also an optional way to store your generated vectors, it's has free tier for development usage.

We're working on a default vector search in memory based approach.