-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supporting more llms and multple commands and improved prompt
- Loading branch information
1 parent
75b5e33
commit 77cc217
Showing
9 changed files
with
216 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using AiTerminal.Abstraction; | ||
using AiTerminal.Models; | ||
using AiTerminal.Providers; | ||
using LlmTornado; | ||
using LlmTornado.Chat.Models; | ||
using LlmTornado.Models; | ||
namespace AiTerminal.Clients | ||
{ | ||
public class LlmTornadoClient(TornadoApi tornadoApi, ChatModel chatModel) : IAiClient | ||
{ | ||
public async Task<string?> GenerateContent(ChatContents contents, ContentModel systemInstructions) | ||
{ | ||
var conversion = tornadoApi.Chat.CreateConversation(chatModel); | ||
foreach (var systemInstructionPart in systemInstructions.Parts) | ||
{ | ||
conversion.AppendSystemMessage(systemInstructionPart.Text); | ||
} | ||
if (conversion != null) | ||
{ | ||
foreach (var contentModel in contents.ContentModels) | ||
{ | ||
foreach (var part in contentModel.Parts) | ||
{ | ||
if (contentModel.Role == "user") | ||
conversion.AppendUserInput(part.Text); | ||
else | ||
conversion.AppendExampleChatbotOutput(part.Text); | ||
} | ||
} | ||
} | ||
return await (conversion?.GetResponse() ?? Task.FromResult(default(string))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.