Skip to content

add confidence #900

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

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ public class AgentKnowledgeBase
public string Type { get; set; }
public bool Disabled { get; set; }

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public decimal? Confidence { get; set; }

public AgentKnowledgeBase()
{

}

public AgentKnowledgeBase(string name, string type, bool enabled)
public AgentKnowledgeBase(
string name, string type,
bool enabled, decimal? confidence = null)
{
Name = name;
Type = type;
Disabled = enabled;
Confidence = confidence;
}

public override string ToString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class ConversationDialogDocument : MongoBase
{
public string ConversationId { get; set; } = default!;
public string AgentId { get; set; } = default!;
public string UserId { get; set; } = default!;
public DateTime UpdatedTime { get; set; }
public List<DialogMongoElement> Dialogs { get; set; } = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class ConversationStateDocument : MongoBase
{
public string ConversationId { get; set; } = default!;
public string AgentId { get; set; } = default!;
public string UserId { get; set; } = default!;
public DateTime UpdatedTime { get; set; }
public List<StateMongoElement> States { get; set; } = [];
public List<BreakpointMongoElement> Breakpoints { get; set; } = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ public class AgentKnowledgeBaseMongoElement
public string Name { get; set; } = default!;
public string Type { get; set; } = default!;
public bool Disabled { get; set; }
public decimal? Confidence { get; set; }

public static AgentKnowledgeBaseMongoElement ToMongoElement(AgentKnowledgeBase knowledgeBase)
{
return new AgentKnowledgeBaseMongoElement
{
Name = knowledgeBase.Name,
Type = knowledgeBase.Type,
Disabled = knowledgeBase.Disabled
Disabled = knowledgeBase.Disabled,
Confidence = knowledgeBase.Confidence
};
}

Expand All @@ -25,7 +27,8 @@ public static AgentKnowledgeBase ToDomainElement(AgentKnowledgeBaseMongoElement
{
Name = knowledgeBase.Name,
Type = knowledgeBase.Type,
Disabled = knowledgeBase.Disabled
Disabled = knowledgeBase.Disabled,
Confidence = knowledgeBase.Confidence
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ public void CreateNewConversation(Conversation conversation)
if (conversation == null) return;

var utcNow = DateTime.UtcNow;
var userId = !string.IsNullOrEmpty(conversation.UserId) ? conversation.UserId : string.Empty;
var convDoc = new ConversationDocument
{
Id = !string.IsNullOrEmpty(conversation.Id) ? conversation.Id : Guid.NewGuid().ToString(),
AgentId = conversation.AgentId,
UserId = !string.IsNullOrEmpty(conversation.UserId) ? conversation.UserId : string.Empty,
UserId = userId,
Title = conversation.Title,
Channel = conversation.Channel,
ChannelId = conversation.ChannelId,
Expand All @@ -30,6 +31,7 @@ public void CreateNewConversation(Conversation conversation)
Id = Guid.NewGuid().ToString(),
ConversationId = convDoc.Id,
AgentId = conversation.AgentId,
UserId = userId,
Dialogs = [],
UpdatedTime = utcNow
};
Expand All @@ -39,6 +41,7 @@ public void CreateNewConversation(Conversation conversation)
Id = Guid.NewGuid().ToString(),
ConversationId = convDoc.Id,
AgentId = conversation.AgentId,
UserId = userId,
States = [],
Breakpoints = [],
UpdatedTime = utcNow
Expand Down
Loading