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 options like temperature to LangChain CLI OpenAI provider command #239

Open
3 tasks done
HavenDV opened this issue Apr 23, 2024 · 1 comment
Open
3 tasks done
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/Commands/Auth/OpenAiCommand.cs09d364b Edit
  • Modify src/Cli/src/Commands/Auth/OpenAiCommand.cs09d364b Edit
  • Modify src/Providers/OpenAI/src/OpenAiConfiguration.cs09d364b 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: 3e0d1ac776).


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

File Path Proposed Changes
src/Cli/src/Commands/Auth/OpenAiCommand.cs Modify src/Cli/src/Commands/Auth/OpenAiCommand.cs with contents:
In the OpenAiCommand constructor, add a new Option for temperature after the modelOption:

```csharp
var temperatureOption = new Option<double?>(
aliases: ["--temperature", "-t"],
getDefaultValue: () => null,
description: "The temperature to use for OpenAI requests");
AddOption(temperatureOption);
```

Then update the SetHandler call to pass temperatureOption:

```csharp
this.SetHandler(HandleAsync, apiKeyArgument, modelOption, temperatureOption);
```
src/Cli/src/Commands/Auth/OpenAiCommand.cs Modify src/Cli/src/Commands/Auth/OpenAiCommand.cs with contents:
Update the HandleAsync method to accept the temperature parameter:

```csharp
private static async Task HandleAsync(string apiKey, string model, double? temperature)
{
await Helpers.AuthenticateWithApiKeyAsync(apiKey, model, Providers.OpenAi, temperature).ConfigureAwait(false);
}
```
src/Cli/src/Helpers.cs Modify src/Cli/src/Helpers.cs with contents:
Update the AuthenticateWithApiKeyAsync method signature to accept the temperature parameter:

```csharp
public static async Task AuthenticateWithApiKeyAsync(string apiKey, string model, string provider, double? temperature)
```
src/Cli/src/Helpers.cs Modify src/Cli/src/Helpers.cs with contents:
In the AuthenticateWithApiKeyAsync method, write the temperature value to a settings file after writing the model:

```csharp
if (temperature.HasValue)
{
await File.WriteAllTextAsync(Path.Combine(settingsFolder, "temperature.txt"), temperature.Value.ToString()).ConfigureAwait(false);
}
```

🎉 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