Skip to content

Conversation

@danijerez
Copy link
Contributor

I made an adapter to add the vertexai provider plugin from the implementation I made at https://github.com/tryAGI/LangChain.Providers/tree/main/src/Google.VertexAI/src.

The code may need some correction, it is the first one I have done, if it is functional it could be abstracted to be able to use all the providers and implementation in langchain dotnet.


public async Task<RoleDialogModel> GetChatCompletions(Agent agent, List<RoleDialogModel> conversations)
{
var hooks = _services.GetServices<IContentGeneratingHook>().ToList();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use HookEmitter.Emit to simplify the Hook invocation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any example of use? I didn't find it in the rest of the implementations (HookEmitter.Emit)

Regarding the tools, they are configured through VertexAIConfiguration (Test: ToolChat). Would it be worth doing it like this?
https://github.com/tryAGI/LangChain.Providers/blob/main/src/Google.VertexAI/test/VertexAITest.cs

public class TextCompletionProvider(
VertexAIConfiguration config,
ChatSettings settings,
ILogger<TextCompletionProvider> logger,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please beautify the format:

    public class TextCompletionProvider(VertexAIConfiguration config,
            ChatSettings settings,
            ILogger<TextCompletionProvider> logger,
            IServiceProvider services) : ITextCompletion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

using Microsoft.Extensions.DependencyInjection;
using System;

namespace BotSharp.Plugin.VertexAI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this format:

namespace BotSharp.Plugin.VertexAI;

public class VertexAiPlugin : IBotSharpPlugin
{
    ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

@Oceania2018
Copy link
Member

Hi Daniel,

Thanks for your contribution, the overall coding struct is look good. Some minor changes I have commented.
One thing I've noticed is there is no function call is implemented, that means agent can't use tools. That will be a problem once user switched to this provider. It would be great if you can add the capabilities for this provider.

Thanks,
Best

@Oceania2018 Oceania2018 merged commit a6ffbc3 into SciSharp:master Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants