Class AIAgent
Proxy class for the AI Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.
Inherited Members
Namespace: SuperOfficeCRMServices
Assembly: SuperOffice.Services.Implementation.dll
Syntax
public class AIAgent : IAIAgent, IAgent
Constructors
AIAgent(ITextServicesImplementation, IBizCardImplementation, ICategorizationStatusResponseImplementation, ICategoryGuessImplementation, IChatbotTurnImplementation, ICopilotDataSourceEntityImplementation, ICopilotEntityImplementation, IFormDesignCarrierImplementation, ISentimentImplementation, IRagAnswerImplementation, IRagResultImplementation, ISummarizerImplementation, ISoRequestItemsAccessor)
Declaration
public AIAgent(ITextServicesImplementation textServicesImplementation, IBizCardImplementation bizCardImplementation, ICategorizationStatusResponseImplementation categorizationStatusResponseImplementation, ICategoryGuessImplementation categoryGuessImplementation, IChatbotTurnImplementation chatbotTurnImplementation, ICopilotDataSourceEntityImplementation copilotDataSourceEntityImplementation, ICopilotEntityImplementation copilotEntityImplementation, IFormDesignCarrierImplementation formDesignCarrierImplementation, ISentimentImplementation sentimentImplementation, IRagAnswerImplementation ragAnswerImplementation, IRagResultImplementation ragResultImplementation, ISummarizerImplementation summarizerImplementation, ISoRequestItemsAccessor accessor)
Parameters
| Type | Name | Description |
|---|---|---|
| ITextServicesImplementation | textServicesImplementation | |
| IBizCardImplementation | bizCardImplementation | |
| ICategorizationStatusResponseImplementation | categorizationStatusResponseImplementation | |
| ICategoryGuessImplementation | categoryGuessImplementation | |
| IChatbotTurnImplementation | chatbotTurnImplementation | |
| ICopilotDataSourceEntityImplementation | copilotDataSourceEntityImplementation | |
| ICopilotEntityImplementation | copilotEntityImplementation | |
| IFormDesignCarrierImplementation | formDesignCarrierImplementation | |
| ISentimentImplementation | sentimentImplementation | |
| IRagAnswerImplementation | ragAnswerImplementation | |
| IRagResultImplementation | ragResultImplementation | |
| ISummarizerImplementation | summarizerImplementation | |
| SuperOffice.Factory.ISoRequestItemsAccessor | accessor |
AIAgent(ITextServicesImplementation, IBizCardImplementation, ICategorizationStatusResponseImplementation, ICategoryGuessImplementation, IChatbotTurnImplementation, ICopilotDataSourceEntityImplementation, ICopilotEntityImplementation, IFormDesignCarrierImplementation, ISentimentImplementation, IRagAnswerImplementation, IRagResultImplementation, ISummarizerImplementation, ISoRequestItemsAccessor, IDebugUser, IServiceCallsRepository, IScriptingConfiguration, IOnlineConfiguration)
Declaration
public AIAgent(ITextServicesImplementation textServicesImplementation, IBizCardImplementation bizCardImplementation, ICategorizationStatusResponseImplementation categorizationStatusResponseImplementation, ICategoryGuessImplementation categoryGuessImplementation, IChatbotTurnImplementation chatbotTurnImplementation, ICopilotDataSourceEntityImplementation copilotDataSourceEntityImplementation, ICopilotEntityImplementation copilotEntityImplementation, IFormDesignCarrierImplementation formDesignCarrierImplementation, ISentimentImplementation sentimentImplementation, IRagAnswerImplementation ragAnswerImplementation, IRagResultImplementation ragResultImplementation, ISummarizerImplementation summarizerImplementation, ISoRequestItemsAccessor accessor, IDebugUser debugUser, IServiceCallsRepository serviceCallsRepository, ConfigFile.IScriptingConfiguration scriptingConfiguration, ConfigFile.IOnlineConfiguration onlineConfiguration)
Parameters
| Type | Name | Description |
|---|---|---|
| ITextServicesImplementation | textServicesImplementation | |
| IBizCardImplementation | bizCardImplementation | |
| ICategorizationStatusResponseImplementation | categorizationStatusResponseImplementation | |
| ICategoryGuessImplementation | categoryGuessImplementation | |
| IChatbotTurnImplementation | chatbotTurnImplementation | |
| ICopilotDataSourceEntityImplementation | copilotDataSourceEntityImplementation | |
| ICopilotEntityImplementation | copilotEntityImplementation | |
| IFormDesignCarrierImplementation | formDesignCarrierImplementation | |
| ISentimentImplementation | sentimentImplementation | |
| IRagAnswerImplementation | ragAnswerImplementation | |
| IRagResultImplementation | ragResultImplementation | |
| ISummarizerImplementation | summarizerImplementation | |
| SuperOffice.Factory.ISoRequestItemsAccessor | accessor | |
| SuperOffice.Data.IDebugUser | debugUser | |
| SuperOffice.Diagnostics.IServiceCallsRepository | serviceCallsRepository | |
| SuperOffice.Configuration.ConfigFile.IScriptingConfiguration | scriptingConfiguration | |
| SuperOffice.Configuration.ConfigFile.IOnlineConfiguration | onlineConfiguration |
Methods
AnalyzeBizCardImageAsync(Stream, bool, CancellationToken)
Returns contact and person information from an image. Merges results with matching database records if merge = true
Declaration
public Task<BizCard> AnalyzeBizCardImageAsync(Stream image, bool mergeWithDatabase, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | image | Image data containg a business card |
| bool | mergeWithDatabase | Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities. |
| CancellationToken | cancellationToken | This operation can be cancelled |
Returns
| Type | Description |
|---|---|
| TaskBizCard | Returns a Contact and a Person entity. |
AnalyzeBizCardTextAsync(string, bool, CancellationToken)
Extract contact and person information from text. Merge results with matching database records if merge = true
Declaration
public Task<BizCard> AnalyzeBizCardTextAsync(string text, bool mergeWithDatabase, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text that contains useful contact and person information. |
| bool | mergeWithDatabase | Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities. |
| CancellationToken | cancellationToken | This operation can be cancelled |
Returns
| Type | Description |
|---|---|
| TaskBizCard | Returns a Contact and a Person entity. |
AnswerAcceptedAsync(string, CancellationToken)
Signal that answer was inserted into response- feedback is logged and used to improve the answer algorithm.
Declaration
public Task AnswerAcceptedAsync(string trackingId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | trackingId | The id of the answer that you are giving feedback to. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
AnswerAsync(string, string, RagType, int, CancellationToken)
Returns an answer.
Declaration
public Task<RagAnswer> AnswerAsync(string namespaceName, string query, RagType type, int top, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | namespaceName | Defines the search domain used for generating answer. e.g. 'ServiceCopilot' |
| string | query | Question. The search query to answer. |
| SuperOffice.Data.RagType | type | Filter results based on content type. Default: None = no filtering |
| int | top | Max Number of results to use in generating answer. |
| CancellationToken | cancellationToken | This operation can be cancelled |
Returns
| Type | Description |
|---|---|
| TaskRagAnswer | Generated answer based on query. |
AnswerFeedbackAsync(string, bool, CancellationToken)
Send feedback on answer - feedback is logged and used to improve the answer algorithm.
Declaration
public Task AnswerFeedbackAsync(string trackingId, bool isThumbsUp, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | trackingId | The id of the answer that you are giving feedback to. |
| bool | isThumbsUp | True = Like, False = Dislike. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
ClearChatbotTurnsAsync(string, CancellationToken)
Clears the stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name
Declaration
public Task ClearChatbotTurnsAsync(string chatId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | chatId | identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary) |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
CreateDefaultCopilotDataSourceEntityAsync(CancellationToken)
Loading default values into a new CopilotDataSourceEntity.
Declaration
public Task<CopilotDataSourceEntity> CreateDefaultCopilotDataSourceEntityAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskCopilotDataSourceEntity | New CopilotDataSourceEntity with default values |
CreateDefaultCopilotEntityAsync(CancellationToken)
Loading default values into a new CopilotEntity.
Declaration
public Task<CopilotEntity> CreateDefaultCopilotEntityAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskCopilotEntity | New CopilotEntity with default values |
CreateTextForAppointmentAsync(AppointmentEntity, string, CancellationToken)
Generate agenda text for an appointment based on appointment's company category, title, person, etc.
Declaration
public Task<string> CreateTextForAppointmentAsync(AppointmentEntity appointment, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppointmentEntity | appointment | The appointment object to generate text for. |
| string | isoLangCode | Language returned text should be in. Blank = do not specify language. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Agenda text in markdown format |
DeleteCopilotDataSourceEntityAsync(int, CancellationToken)
Deletes the CopilotDataSourceEntity
Declaration
public Task DeleteCopilotDataSourceEntityAsync(int copilotDataSourceEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | copilotDataSourceEntityId | The identity of the CopilotDataSourceEntity |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteCopilotEntityAsync(int, CancellationToken)
Deletes the CopilotEntity
Declaration
public Task DeleteCopilotEntityAsync(int copilotEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | copilotEntityId | The identity of the CopilotEntity |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DetectLanguageAsync(string, CancellationToken)
Given a (reasonably short) text, detect the language it is written in
Declaration
public Task<string> DetectLanguageAsync(string text, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text to be analyzed; there may be a cost-per-character so do not send a book here |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | ISO Language code, such as NO, US, ES, FR |
DetectSentimentAsync(string, CancellationToken)
Detect the sentiment of a (reasonably short) text. Sentiment analysis may cause a translation to be made, since sentiment analysis only supports a limited set of languages
Declaration
public Task<Sentiment> DetectSentimentAsync(string text, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text to be analyzed |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskSentiment | The sentiment information: score (-100 to +100) and confidence |
ExpandTextAsync(string, int, string, CancellationToken)
Generate a longer version of a text
Declaration
public Task<string> ExpandTextAsync(string text, int percentBigger, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text to embiggen |
| int | percentBigger | How much to embiggen. |
| string | isoLangCode | Language returned text should be in. Blank = do not specify language. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Expanded version of the text |
GetChatbotPromptSuggestionsAsync(string, string, int, CancellationToken)
Return one or more suggested prompts as actions to display in an empty chat window
Declaration
public Task<ChatbotTurn> GetChatbotPromptSuggestionsAsync(string isoLangCode, string soProtocol, int currentId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | isoLangCode | ISO2 Language code ('en', 'no', 'de'...) for suggestions in response |
| string | soProtocol | Context for suggestions ('contact.main.activities') |
| int | currentId | current company/person/project id - used for context in suggestions |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskChatbotTurn | Contains zero or more BotActions, and welcome message in Bot response |
GetChatbotResponseAsync(string, string, string, string, ChatbotTurn[], string, CancellationToken)
Return a chatbot response given prompt and previous turns. Stores the new turn in the history for the chatId
Declaration
public Task<ChatbotTurn> GetChatbotResponseAsync(string chatId, string isoLangCode, string userPrompt, string displayValue, ChatbotTurn[] previousTurns, string apiUrl, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | chatId | identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary) |
| string | isoLangCode | ISO2 Language code ('en', 'no', 'de'...) for suggestions in response |
| string | userPrompt | User question for chatbot |
| string | displayValue | User question for display - optional - null = use userPrompt |
| ChatbotTurn | previousTurns | Chat history - all previous turns in chronological order |
| string | apiUrl | CRM API endpoint URL for chatbot to make callbacks to. 'https://example.com/superoffice/api/' |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskChatbotTurn | Returns new turn that client can append to its local history. |
GetChatbotTurnsAsync(string, CancellationToken)
Returns stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name.
Declaration
public Task<ChatbotTurn[]> GetChatbotTurnsAsync(string chatId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | chatId | identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary) |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskChatbotTurn | Array containing zero or more turns. If you got zero turns, call GetChatbotPromptSuggestions to get an initial turn from the bot. |
GetCopilotDataSourceEntityAsync(int, CancellationToken)
Gets a CopilotDataSourceEntity object.
Declaration
public Task<CopilotDataSourceEntity> GetCopilotDataSourceEntityAsync(int copilotDataSourceEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | copilotDataSourceEntityId | The identifier of the CopilotDataSourceEntity object |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskCopilotDataSourceEntity | A single CopilotDataSourceEntity |
GetCopilotEntityAsync(int, CancellationToken)
Gets a CopilotEntity object.
Declaration
public Task<CopilotEntity> GetCopilotEntityAsync(int copilotEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | copilotEntityId | The identifier of the CopilotEntity object |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskCopilotEntity | A single CopilotEntity |
GetFormDesignFromImageAsync(Stream, CancellationToken)
Returns Form Designer properties based on the look of a picture
Declaration
public Task<StringDictionary> GetFormDesignFromImageAsync(Stream image, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | image | Image data to analyze for design |
| CancellationToken | cancellationToken | This operation can be cancelled |
Returns
| Type | Description |
|---|---|
| TaskSuperOffice.CRM.Services.StringDictionary | Returns a Form Designer properties. |
GetFormDesignFromUrlAsync(string, CancellationToken)
Returns Form Designer properties based on the look of a web page
Declaration
public Task<StringDictionary> GetFormDesignFromUrlAsync(string url, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | Url of the web page to extract style from. |
| CancellationToken | cancellationToken | This operation can be cancelled |
Returns
| Type | Description |
|---|---|
| TaskSuperOffice.CRM.Services.StringDictionary | Returns a Form Designer properties. |
GetSummarizeContactPromptAsync(int, int, string, string, CancellationToken)
Return the prompt used to get a short summary of the activities on a contact. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
Declaration
public Task<ChatbotTurn> GetSummarizeContactPromptAsync(int contactId, int numSentences, string summary, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contactId | Contact id to summarize |
| int | numSentences | Length of summary |
| string | summary | Chatbot's summary of the contact activities |
| string | isoLangCode | Language returned text should be in. Blank = do not specify language. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskChatbotTurn | Display text and Prompt used to generate a short summary of the activities on a contact. |
GetSummarizeSalePromptAsync(int, int, string, string, CancellationToken)
Return the prompt used to get a short summary of the activities on a sale. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
Declaration
public Task<ChatbotTurn> GetSummarizeSalePromptAsync(int saleId, int numSentences, string summary, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | saleId | Sale id to summarize |
| int | numSentences | Length of summary |
| string | summary | Chatbot's summary of the sale activities |
| string | isoLangCode | Language returned text should be in |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskChatbotTurn | Display text and Prompt used to generate a short summary of the activities on a sale. |
GetSummarizeTicketPromptAsync(int, int, string, string, CancellationToken)
Return the prompt used to get a short summary of the messages on a ticket. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
Declaration
public Task<ChatbotTurn> GetSummarizeTicketPromptAsync(int ticketId, int numSentences, string summary, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | ticketId | Ticket id to summarize |
| int | numSentences | Length of summary |
| string | summary | Chatbot's summary of the ticket |
| string | isoLangCode | Language returned text should be in |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskChatbotTurn | Display text and Prompt used to generate a short summary of the messages on a ticket. |
GetTrainingStatusAsync(CancellationToken)
Calling the HugoAI endpoint to fetch the current training status.
Declaration
public Task<CategorizationStatusResponse> GetTrainingStatusAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskCategorizationStatusResponse | Carrier to describe the current status of HugoAI categorization |
GuessCategoryAsync(int, CancellationToken)
Given a ticket's id, guess the ticket category it should be placed in. Currently this is based on the first message in the ticket
Declaration
public Task<int> GuessCategoryAsync(int ticketId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | ticketId | Id of ticket to guess category for |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskint | Suggested ticket category ID |
RephraseTextAsync(string, AiTextStyle, string, CancellationToken)
Generate a new version of a text
Declaration
public Task<string> RephraseTextAsync(string text, AiTextStyle style, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text to transform |
| SuperOffice.Data.AiTextStyle | style | New style to transform text into (Rephrase, Correct, Casual, Formal) |
| string | isoLangCode | Language returned text should be in. Blank = do not specify language. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | New version of the text |
SaveCopilotDataSourceEntityAsync(CopilotDataSourceEntity, CancellationToken)
Updates the existing CopilotDataSourceEntity or creates a new CopilotDataSourceEntity if the id parameter is 0.
Declaration
public Task<CopilotDataSourceEntity> SaveCopilotDataSourceEntityAsync(CopilotDataSourceEntity copilotDataSourceEntity, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CopilotDataSourceEntity | copilotDataSourceEntity | The CopilotDataSourceEntity that is saved |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskCopilotDataSourceEntity | New or updated CopilotDataSourceEntity |
SaveCopilotEntityAsync(CopilotEntity, CancellationToken)
Updates the existing CopilotEntity or creates a new CopilotEntity if the id parameter is 0.
Declaration
public Task<CopilotEntity> SaveCopilotEntityAsync(CopilotEntity copilotEntity, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CopilotEntity | copilotEntity | The CopilotEntity that is saved |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| TaskCopilotEntity | New or updated CopilotEntity |
SearchAsync(string, string, RagType, int, CancellationToken)
Returns semantic search results from vector database.
Declaration
public Task<RagResult[]> SearchAsync(string namespaceName, string query, RagType type, int top, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | namespaceName | Defines the search domain. e.g. 'ServiceCopilot'. |
| string | query | Search query. |
| SuperOffice.Data.RagType | type | Filter results based on a specific content type. Default: None = no filtering |
| int | top | Max Number of results to return. |
| CancellationToken | cancellationToken | This operation can be cancelled |
Returns
| Type | Description |
|---|---|
| TaskRagResult | Array containing vector search results |
StartRagIndexingAsync(string, string, CancellationToken)
Kicks off a batch task to update the RAG index
Declaration
public Task<int> StartRagIndexingAsync(string namespaceName, string sourceId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | namespaceName | Defines the search domain. e.g. 'ServiceCopilot'. |
| string | sourceId | (Optional) Identifies the data source to update. Blank = all sources |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskint | The batch task id |
SummarizeContactAsync(int, int, string, CancellationToken)
Generate a short summary of the activities on a contact
Declaration
public Task<string> SummarizeContactAsync(int contactId, int numSentences, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contactId | Contact id to summarize |
| int | numSentences | Length of summary |
| string | isoLangCode | Language returned text should be in. Blank = do not specify language. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Short summary of the activities on a contact - in HTML. |
SummarizeSaleAsync(int, int, string, CancellationToken)
Generate a short summary of the activities on a sale
Declaration
public Task<string> SummarizeSaleAsync(int saleId, int numSentences, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | saleId | Sale id to summarize |
| int | numSentences | Length of summary |
| string | isoLangCode | Language returned text should be in. Blank = do not specify language. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Short summary of the activities on a sale - in HTML. |
SummarizeTextAsync(string, int, string, CancellationToken)
Generate a short summary of a text
Declaration
public Task<string> SummarizeTextAsync(string text, int percentSmaller, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text to summarize |
| int | percentSmaller | How much to shorten. |
| string | isoLangCode | Language returned text should be in. Blank = do not specify language. |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Short summary of the text |
SummarizeTicketAsync(int, int, string, CancellationToken)
Generate a short summary of the messages on a ticket
Declaration
public Task<string> SummarizeTicketAsync(int ticketId, int numSentences, string isoLangCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | ticketId | Ticket id to summarize |
| int | numSentences | Length of summary |
| string | isoLangCode | Language returned text should be in |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Short summary of the messages on a ticket - in HTML. |
TrainCategoryGuesserAsync(int, int, int, CancellationToken)
The category guesser training API will be called with an array of CategorizationTrainingItem during the (background, Batch) execution of this call
Declaration
public Task<string> TrainCategoryGuesserAsync(int selectionId, int maxItems, int maxTextLength, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | selectionId | Id of selection of tickets, to retrieve training data from |
| int | maxItems | Maximum number of tickets to retrieve data from |
| int | maxTextLength | Maximum length of PlainTextBody or any other large text, truncated to nearest word boundary |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Placeholder for result... should this be a BatchTaskId? maybe not useful? |
TranslateAsync(string, string, CancellationToken)
Translate a text from one language to another. Language of the text is automatically detected.
Declaration
public Task<string> TranslateAsync(string text, string targetLanguage, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text to be translated. Language of the text is automatically detected. |
| string | targetLanguage | ISO Language code (such as FR) to translate the text into |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Translated text |
TranslateEntityAsync(string, int, string, CancellationToken)
Retrieve, format and translate text for an entity to a specified language
Declaration
public Task<string> TranslateEntityAsync(string entityName, int entityId, string targetLanguage, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | entityName | Name of entity to get the text to be translated; eg., 'ticketMessage' |
| int | entityId | Identifier for the entity to get text to be translated |
| string | targetLanguage | ISO Language code (such as FR) to translate the text into |
| CancellationToken | cancellationToken | This operation cannot be cancelled; the cancellationToken parameter is ignored |
Returns
| Type | Description |
|---|---|
| Taskstring | Translated text |