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

Add Together provider support to LangChain CLI #238

Open
2 tasks done
HavenDV opened this issue Apr 23, 2024 · 1 comment
Open
2 tasks done

Add Together provider support to LangChain CLI #238

HavenDV opened this issue Apr 23, 2024 · 1 comment
Labels
cli enhancement New feature or request sweep

Comments

@HavenDV
Copy link
Contributor

HavenDV commented Apr 23, 2024

What would you like to be added:

Why is this needed:

Anything else we need to know?

Checklist
  • Modify src/Cli/src/Providers.cs8724d6b Edit
  • Modify src/Cli/src/Commands/SummarizeCommand.cs8724d6b Edit
@HavenDV HavenDV added the sweep label Apr 23, 2024
Copy link
Contributor

sweep-ai bot commented Apr 23, 2024


Tip

I can email you next time I complete a pull request if you set up your email here!


Actions (click)

  • ↻ Restart Sweep

❌ Unable to Complete PR

I'm sorry, but it looks like an error has occurred due to a planning failure. Feel free to add more details to the issue description so Sweep can better address it. Alternatively, reach out to Kevin or William for help at https://discord.gg/sweep.

For bonus GPT-4 tickets, please report this bug on Discord (tracking ID: ad85373223).


Please look at the generated plan. If something looks wrong, please add more details to your issue.

File Path Proposed Changes
src/Cli/src/Providers.cs Modify src/Cli/src/Providers.cs with contents:
In the Providers class, add a new constant for the Together provider:

```csharp
public const string TogetherAi = "togetherai";
```

This will allow us to check for and use the Together provider in other parts of the CLI code.
src/Cli/src/Commands/SummarizeCommand.cs Modify src/Cli/src/Commands/SummarizeCommand.cs with contents:
In the SummarizeCommand class, modify the HandleAsync method to support the Together provider:

First, add a new Option for specifying the provider:

```csharp
var providerOption = new Option(
aliases: ["--provider", "-p"],
getDefaultValue: () => Providers.OpenAi,
description: "Provider to use for summarization (default: OpenAI)");

AddOption(providerOption);
```

Then update the method signature to accept the provider option:

```csharp
private static async Task HandleAsync(string input, string inputPath, string outputPath, int wordCount, string provider)
```

Inside the method, check if the Together provider is specified. If so, use the TogetherAiModel to generate the summary:

```csharp
if (provider == Providers.TogetherAi)
{
var togetherAiProvider = new TogetherAiProvider();
var model = new TogetherAiModel(togetherAiProvider, TogetherAiModelIds.TogetherAiGpt3_5);

outputText = await model.GenerateAsync(
$"""
Please summarize the the following text in {wordCount} words or less:
{inputText}
""");
}
else
{
outputText = await Helpers.GenerateUsingAuthenticatedModelAsync(
$"""
Please summarize the the following text in {wordCount} words or less:
{inputText}
""").ConfigureAwait(false);
}
```

This checks if the provider argument equals the new `Providers.TogetherAi` constant. If so, it creates a `TogetherAiProvider` and `TogetherAiModel` to generate the summary. Otherwise, it falls back to the existing OpenAI provider logic.

The `TogetherAiModel` constructor takes the provider instance and a `TogetherAiModelIds` enum value to specify which Together model to use.

🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli enhancement New feature or request sweep
Projects
None yet
1 participant