Skip to content

Commit

Permalink
Cherry pick branch 'genexuslabs:embedding-data-type' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiamurialdo authored and Beta Bot committed Nov 29, 2024
1 parent 45e9192 commit 0e15f30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions dotnet/src/dotnetcore/Providers/AI/Model/GXAgent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using GeneXus.AI.Chat;
using GeneXus.Procedure;
using GeneXus.Utils;
using OpenAI.Chat;

namespace GeneXus.AI
{
Expand All @@ -21,7 +22,9 @@ protected string CallAgent(string assistant, GXProperties gxproperties, IList ch
try
{
GXLogging.Debug(log, "Calling Agent: ", assistant);
return AgentService.AgentHandlerInstance.Assistant(assistant, (List<Chat.ChatMessage>)chatMessages, gxproperties).GetAwaiter().GetResult();

List<ChatMessage> chatMessagesList = chatMessages!=null ? chatMessages.Cast<ChatMessage>().ToList() :null;
return AgentService.AgentHandlerInstance.Assistant(assistant, chatMessagesList, gxproperties).GetAwaiter().GetResult();
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ internal async Task<string> Assistant(string assistant, List<Chat.ChatMessage> m
GXLogging.Debug(log, "Agent response:", responseJson);
ChatCompletionResult chatCompletion = JsonSerializer.Deserialize<ChatCompletionResult>(responseJson);

if (chatCompletion != null)
if (chatCompletion != null && chatCompletion.Choices!=null)
{
foreach (Choice choice in chatCompletion.Choices)
{
Expand Down

0 comments on commit 0e15f30

Please sign in to comment.