Open HavenDV opened 4 months ago
[!TIP] I can email you next time I complete a pull request if you set up your email here!
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<br/>var providerOption = new Option<string>(<br/> aliases: ["--provider", "-p"], <br/> getDefaultValue: () => Providers.OpenAi,<br/> description: "Provider to use for summarization (default: OpenAI)");<br/><br/>AddOption(providerOption);<br/>\```<br/><br/>Then update the method signature to accept the provider option:<br/><br/>\```csharp <br/>private static async Task HandleAsync(string input, string inputPath, string outputPath, int wordCount, string provider) <br/>\```<br/><br/>Inside the method, check if the Together provider is specified. If so, use the TogetherAiModel to generate the summary:<br/><br/>\```csharp<br/>if (provider == Providers.TogetherAi)<br/>{<br/> var togetherAiProvider = new TogetherAiProvider();<br/> var model = new TogetherAiModel(togetherAiProvider, TogetherAiModelIds.TogetherAiGpt3_5);<br/> <br/> outputText = await model.GenerateAsync(<br/> $"""<br/> Please summarize the the following text in {wordCount} words or less:<br/> {inputText}<br/> """);<br/>}<br/>else <br/>{<br/> outputText = await Helpers.GenerateUsingAuthenticatedModelAsync(<br/> $"""<br/> Please summarize the the following text in {wordCount} words or less:<br/> {inputText}<br/> """).ConfigureAwait(false);<br/>}<br/>\```<br/><br/>This checks if the providerargument equals the new Providers.TogetherAiconstant. If so, it creates a TogetherAiProviderand TogetherAiModelto generate the summary. Otherwise, it falls back to the existing OpenAI provider logic.<br/><br/>The TogetherAiModelconstructor takes the provider instance and a TogetherAiModelIds` enum value to specify which Together model to use. |
💡 To recreate the pull request edit the issue title or description.
What would you like to be added:
Why is this needed:
Anything else we need to know?
Checklist
- [X] Modify `src/Cli/src/Providers.cs` ✓ https://github.com/tryAGI/LangChain/commit/8724d6bfb930b4932e0f67815d6ff6c3a00b7e56 [Edit](https://github.com/tryAGI/LangChain/edit/sweep/add_together_provider_support_to_langcha_72208/src/Cli/src/Providers.cs) - [X] Modify `src/Cli/src/Commands/SummarizeCommand.cs` ✓ https://github.com/tryAGI/LangChain/commit/8724d6bfb930b4932e0f67815d6ff6c3a00b7e56 [Edit](https://github.com/tryAGI/LangChain/edit/sweep/add_together_provider_support_to_langcha_72208/src/Cli/src/Commands/SummarizeCommand.cs)