Skip to content

Commit

Permalink
Maintain implicit 'saia:agent:' prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiamurialdo committed Nov 14, 2024
1 parent 504d406 commit c15535b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions dotnet/src/dotnetcore/Providers/AI/Services/AgentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal class AgentService
{
const string SerializedAdditionalRawDataPty = "SerializedAdditionalRawData";
const string VARIABLES = "variables";
const string SAIA_AGENT = "saia:agent:";
private HttpClient _httpClient;
protected string API_KEY;
protected OpenAIClient _openAIClient;
Expand Down Expand Up @@ -59,7 +60,7 @@ internal AgentService()
_openAIClient = new OpenAIClient(new ApiKeyCredential(API_KEY), options);
}

internal async Task<ChatCompletion> Assistant(string modelId, string userMessage, GXProperties properties)
internal async Task<ChatCompletion> Assistant(string assistant, string userMessage, GXProperties properties)
{

List<ChatMessage> messages = new List<ChatMessage>
Expand All @@ -78,7 +79,7 @@ internal async Task<ChatCompletion> Assistant(string modelId, string userMessage
};
fieldInfo.SetValue(customOptions, SerializedAdditionalRawData);
}
ChatClient client = _openAIClient.GetChatClient(modelId);
ChatClient client = _openAIClient.GetChatClient($"{SAIA_AGENT}{assistant}");

ClientResult<ChatCompletion> response = await client.CompleteChatAsync(messages, customOptions);

Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/DotNetCoreUnitTest/Domain/GxEmbeddingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task AssistantTest()
{
AgentService agentService = AgentService.AgentHandlerInstance;
string userMessage = "What's the weather like in Buenos Aires today?";
string modelId = "saia:agent:e4e7a837-b8ad-4d25-b2db-431dda9af0af";
string modelId = "e4e7a837-b8ad-4d25-b2db-431dda9af0af";
GXProperties properties = new GXProperties();
properties.Set("$context", "context for reference");
ChatCompletion embedding = await agentService.Assistant(modelId, userMessage, properties);
Expand Down

0 comments on commit c15535b

Please sign in to comment.