> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SuperOffice.WebApi.Agents.AIAgent

# \<a id="SuperOffice\_WebApi\_Agents\_AIAgent">\</a> Class AIAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

AI services, such as Translation, Statistics, Sentiment analysis, backed by calls to Public Cloud providers

```csharp theme={null}
public class AIAgent : AgentBase, IAIAgent, IAgentBase, IDisposable
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[AgentBase](SuperOffice.WebApi.Agents.AgentBase.md) ←
[AIAgent](SuperOffice.WebApi.Agents.AIAgent.md)

#### Implements

[IAIAgent](SuperOffice.WebApi.Agents.IAIAgent.md),
[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

#### Inherited Members

[AgentBase.\_json](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__json),
[AgentBase.\_binary](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__binary),
[AgentBase.\_config](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__config),
[AgentBase.\_client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__client),
[AgentBase.\_disposeClient](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__disposeClient),
[AgentBase.Merge(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Merge_SuperOffice_WebApi_RequestOptions_),
[AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromStream_System_Net_Http_HttpMethod_System_String_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.ParseAuthorization(IAuthorization)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseAuthorization_SuperOffice_WebApi_Authorization_IAuthorization_),
[AgentBase.CancelRequest()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_CancelRequest),
[AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequest(HttpRequestMessage, RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequest_System_Net_Http_HttpRequestMessage_SuperOffice_WebApi_RequestOptions_),
[AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ThrowOnResponseErrorAsync_System_Net_Http_HttpRequestMessage_System_Net_Http_HttpResponseMessage_),
[AgentBase.ParseResponse\<T\&gt;(HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseResponse__1_System_Net_Http_HttpResponseMessage_),
[AgentBase.Finally(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Finally_SuperOffice_WebApi_RequestOptions_),
[AgentBase.Dispose()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Dispose),
[AgentBase.Configuration](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Configuration),
[AgentBase.Client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Client),
[AgentBase.HasRunningRequest](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_HasRunningRequest),
[AgentBase.ClientCancellationTokenSource](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ClientCancellationTokenSource),
[AgentBase.ProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ProgressListener),
[AgentBase.UploadProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_UploadProgressListener),
[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring),
[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)),
[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)),
[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

## Examples

\<pre>\<code class="lang-csharp">using SuperOffice.WebApi;
using SuperOffice.WebApi.Agents;

var mySession = new WebApiOptions("[http://example.com/super/api](http://example.com/super/api)");
mySession.Authorization = new AuthorizationUsernamePassword("user", "pass");
using (AIAgent agent = new AIAgent(mySession))
\{
// call methods on agent here...
}\</code>\</pre>

## Constructors

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_\_ctor\_System\_Net\_Http\_HttpClient\_">\</a> AIAgent(HttpClient)

Constructor: AI services, such as Translation, Statistics, Sentiment analysis, backed by calls to Public Cloud providers

```csharp theme={null}
public AIAgent(HttpClient httpClient)
```

#### Parameters

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Use this HTTP client instead of making own HttpClient instance.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_\_ctor\_SuperOffice\_WebApi\_WebApiOptions\_System\_Net\_Http\_HttpClient\_">\</a> AIAgent(WebApiOptions, HttpClient)

Constructor: AI services, such as Translation, Statistics, Sentiment analysis, backed by calls to Public Cloud providers

```csharp theme={null}
public AIAgent(WebApiOptions options, HttpClient httpClient = null)
```

#### Parameters

`options` [WebApiOptions](SuperOffice.WebApi.WebApiOptions.md)

Base URL and authentication values.

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Optional: Use this HTTP client instead of making a new one.

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_AnalyzeBizCardImageAsync\_System\_Byte\_\_\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AnalyzeBizCardImageAsync(byte\[], bool, RequestOptions)

Returns contact and person information from an image. Merges results with matching database records if merge = true

```csharp theme={null}
public Task<BizCard> AnalyzeBizCardImageAsync(byte[] image, bool mergeWithDatabase, RequestOptions requestOptions = null)
```

#### Parameters

`image` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Image data containg a business card

`mergeWithDatabase` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BizCard](SuperOffice.WebApi.Data.BizCard.md)\&gt;

Returns a Contact and a Person entity.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_AnalyzeBizCardTextAsync\_System\_String\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AnalyzeBizCardTextAsync(string, bool, RequestOptions)

Extract contact and person information from text. Merge results with matching database records if merge = true

```csharp theme={null}
public Task<BizCard> AnalyzeBizCardTextAsync(string text, bool mergeWithDatabase, RequestOptions requestOptions = null)
```

#### Parameters

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

Text that contains useful contact and person information.

`mergeWithDatabase` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[BizCard](SuperOffice.WebApi.Data.BizCard.md)\&gt;

Returns a Contact and a Person entity.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_AnswerAcceptedAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AnswerAcceptedAsync(string, RequestOptions)

Signal that answer was inserted into response- feedback is logged and used to improve the answer algorithm.

```csharp theme={null}
public Task AnswerAcceptedAsync(string trackingId, RequestOptions requestOptions = null)
```

#### Parameters

`trackingId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The id of the answer that you are giving feedback to.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_AnswerAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_Data\_RagType\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AnswerAsync(string, string, RagType, int, RequestOptions)

Returns an answer.

```csharp theme={null}
public Task<RagAnswer> AnswerAsync(string namespaceName, string query, RagType type, int top, RequestOptions requestOptions = null)
```

#### Parameters

`namespaceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Defines the search domain used for generating answer. e.g. 'ServiceCopilot'

`query` [string](https://learn.microsoft.com/dotnet/api/system.string)

Question. The search query to answer.

`type` [RagType](SuperOffice.WebApi.Data.RagType.md)

Filter results based on content type. Default: None = no filtering

`top` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Max Number of results to use in generating answer.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[RagAnswer](SuperOffice.WebApi.Data.RagAnswer.md)\&gt;

Generated answer based on query.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_AnswerFeedbackAsync\_System\_String\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AnswerFeedbackAsync(string, bool, RequestOptions)

Send feedback on answer - feedback is logged and used to improve the answer algorithm.

```csharp theme={null}
public Task AnswerFeedbackAsync(string trackingId, bool isThumbsUp, RequestOptions requestOptions = null)
```

#### Parameters

`trackingId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The id of the answer that you are giving feedback to.

`isThumbsUp` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True = Like, False = Dislike.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_AnswerUsingContextAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_Data\_RagContextIds\_SuperOffice\_WebApi\_Data\_RagType\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AnswerUsingContextAsync(string, string, RagContextIds, RagType, int, RequestOptions)

Returns an answer based on the query, and provided context.

```csharp theme={null}
public Task<RagAnswer> AnswerUsingContextAsync(string namespaceName, string query, RagContextIds contextIds, RagType type, int top, RequestOptions requestOptions = null)
```

#### Parameters

`namespaceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Defines the search domain used for generating answer. e.g. 'ServiceCopilot'

`query` [string](https://learn.microsoft.com/dotnet/api/system.string)

Question. The search query to answer.

`contextIds` [RagContextIds](SuperOffice.WebApi.Data.RagContextIds.md)

The IDs of the current context for contact, person, project, sale, and ticket.

`type` [RagType](SuperOffice.WebApi.Data.RagType.md)

Filter results based on content type. Default: None = no filtering

`top` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Max Number of results to use in generating answer.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[RagAnswer](SuperOffice.WebApi.Data.RagAnswer.md)\&gt;

Generated answer based on query.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_CancelIndexingAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CancelIndexingAsync(string, RequestOptions)

Cancel the current re-indexing job on a given namespace. Leaves data in inconsistent state, because removal of old data is skipped.

```csharp theme={null}
public Task<RagStatus> CancelIndexingAsync(string namespaceName, RequestOptions requestOptions = null)
```

#### Parameters

`namespaceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Identifies the namespace to stop indexing in.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[RagStatus](SuperOffice.WebApi.Data.RagStatus.md)\&gt;

Status of the indexing run after cancellation.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_ClearChatbotTurnsAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ClearChatbotTurnsAsync(string, RequestOptions)

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

```csharp theme={null}
public Task ClearChatbotTurnsAsync(string chatId, RequestOptions requestOptions = null)
```

#### Parameters

`chatId` [string](https://learn.microsoft.com/dotnet/api/system.string)

identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_CreateDefaultCopilotDataSourceEntityAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultCopilotDataSourceEntityAsync(RequestOptions)

Set default values into a new CopilotDataSourceEntity.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<CopilotDataSourceEntity> CreateDefaultCopilotDataSourceEntityAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CopilotDataSourceEntity](SuperOffice.WebApi.Data.CopilotDataSourceEntity.md)\&gt;

A blank CopilotDataSourceEntity

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_CreateDefaultCopilotEntityAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultCopilotEntityAsync(RequestOptions)

Set default values into a new CopilotEntity.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<CopilotEntity> CreateDefaultCopilotEntityAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CopilotEntity](SuperOffice.WebApi.Data.CopilotEntity.md)\&gt;

A blank CopilotEntity

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_CreateTextForAppointmentAsync\_SuperOffice\_WebApi\_Data\_AppointmentEntity\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateTextForAppointmentAsync(AppointmentEntity, string, RequestOptions)

Generate agenda text for an appointment based on appointment's company category, title, person, etc.

```csharp theme={null}
public Task<string> CreateTextForAppointmentAsync(AppointmentEntity appointment, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`appointment` [AppointmentEntity](SuperOffice.WebApi.Data.AppointmentEntity.md)

The appointment object to generate text for.

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in. Blank = do not specify language.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Agenda text in markdown format

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_DeleteCopilotDataSourceEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteCopilotDataSourceEntityAsync(int, RequestOptions)

Deletes the CopilotDataSourceEntity

```csharp theme={null}
public Task DeleteCopilotDataSourceEntityAsync(int copilotDataSourceEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`copilotDataSourceEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the CopilotDataSourceEntity

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_DeleteCopilotEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteCopilotEntityAsync(int, RequestOptions)

Deletes the CopilotEntity

```csharp theme={null}
public Task DeleteCopilotEntityAsync(int copilotEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`copilotEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the CopilotEntity

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_DetectLanguageAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DetectLanguageAsync(string, RequestOptions)

Given a (reasonably short) text, detect the language it is written in

```csharp theme={null}
public Task<string> DetectLanguageAsync(string text, RequestOptions requestOptions = null)
```

#### Parameters

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

Text to be analyzed; there may be a cost-per-character so do not send a book here

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

ISO Language code, such as NO, US, ES, FR

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_DetectSentimentAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DetectSentimentAsync(string, RequestOptions)

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

```csharp theme={null}
public Task<Sentiment> DetectSentimentAsync(string text, RequestOptions requestOptions = null)
```

#### Parameters

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

Text to be analyzed

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[Sentiment](SuperOffice.WebApi.Data.Sentiment.md)\&gt;

The sentiment information: score (-100 to +100) and confidence

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_ExpandTextAsync\_System\_String\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ExpandTextAsync(string, int, string, RequestOptions)

Generate a longer version of a text

```csharp theme={null}
public Task<string> ExpandTextAsync(string text, int percentBigger, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

Text to embiggen

`percentBigger` [int](https://learn.microsoft.com/dotnet/api/system.int32)

How much to embiggen.

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in. Blank = do not specify language.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Expanded version of the text

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetChatbotPromptSuggestionsAsync\_System\_String\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatbotPromptSuggestionsAsync(string, string, int, RequestOptions)

Return one or more suggested prompts as actions to display in an empty chat window

```csharp theme={null}
public Task<ChatbotTurn> GetChatbotPromptSuggestionsAsync(string isoLangCode, string soProtocol, int currentId, RequestOptions requestOptions = null)
```

#### Parameters

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

ISO2 Language code ('en', 'no', 'de'...) for suggestions in response

`soProtocol` [string](https://learn.microsoft.com/dotnet/api/system.string)

Context for suggestions ('contact.main.activities')

`currentId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

current company/person/project id - used for context in suggestions

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatbotTurn](SuperOffice.WebApi.Data.ChatbotTurn.md)\&gt;

Contains zero or more BotActions, and welcome message in Bot response

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetChatbotResponseAsync\_System\_String\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_Data\_ChatbotTurn\_\_\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatbotResponseAsync(string, string, string, string, ChatbotTurn\[], string, RequestOptions)

Return a chatbot response given prompt and previous turns. Stores the new turn in the history for the chatId

```csharp theme={null}
public Task<ChatbotTurn> GetChatbotResponseAsync(string chatId, string isoLangCode, string userPrompt, string displayValue, ChatbotTurn[] previousTurns, string apiUrl, RequestOptions requestOptions = null)
```

#### Parameters

`chatId` [string](https://learn.microsoft.com/dotnet/api/system.string)

identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

ISO2 Language code ('en', 'no', 'de'...) for suggestions in response

`userPrompt` [string](https://learn.microsoft.com/dotnet/api/system.string)

User question for chatbot

`displayValue` [string](https://learn.microsoft.com/dotnet/api/system.string)

User question for display - optional - null = use userPrompt

`previousTurns` [ChatbotTurn](SuperOffice.WebApi.Data.ChatbotTurn.md)\[]

Chat history - all previous turns in chronological order

`apiUrl` [string](https://learn.microsoft.com/dotnet/api/system.string)

CRM API endpoint URL for chatbot to make callbacks to. '[https://example.com/superoffice/api/](https://example.com/superoffice/api/)'

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatbotTurn](SuperOffice.WebApi.Data.ChatbotTurn.md)\&gt;

Returns new turn that client can append to its local history.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetChatbotTurnsAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetChatbotTurnsAsync(string, RequestOptions)

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.

```csharp theme={null}
public Task<ChatbotTurn[]> GetChatbotTurnsAsync(string chatId, RequestOptions requestOptions = null)
```

#### Parameters

`chatId` [string](https://learn.microsoft.com/dotnet/api/system.string)

identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatbotTurn](SuperOffice.WebApi.Data.ChatbotTurn.md)\[]\&gt;

Array containing zero or more turns. If you got zero turns, call GetChatbotPromptSuggestions to get an initial turn from the bot.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetCopilotDataSourceEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetCopilotDataSourceEntityAsync(int, RequestOptions)

Gets a specific CopilotDataSourceEntity object.

```csharp theme={null}
public Task<CopilotDataSourceEntity> GetCopilotDataSourceEntityAsync(int copilotDataSourceEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`copilotDataSourceEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the CopilotDataSourceEntity object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CopilotDataSourceEntity](SuperOffice.WebApi.Data.CopilotDataSourceEntity.md)\&gt;

CopilotDataSourceEntity

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetCopilotEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetCopilotEntityAsync(int, RequestOptions)

Gets a specific CopilotEntity object.

```csharp theme={null}
public Task<CopilotEntity> GetCopilotEntityAsync(int copilotEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`copilotEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the CopilotEntity object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CopilotEntity](SuperOffice.WebApi.Data.CopilotEntity.md)\&gt;

CopilotEntity

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetFirstFormDesignCssFromImageAsync\_System\_Byte\_\_\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetFirstFormDesignCssFromImageAsync(byte\[], string, RequestOptions)

Starts a form design analysis from an image, returning the properties for a single CSS class.

```csharp theme={null}
public Task<FormDesignCss> GetFirstFormDesignCssFromImageAsync(byte[] image, string cssClass, RequestOptions requestOptions = null)
```

#### Parameters

`image` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Image data to analyze for design

`cssClass` [string](https://learn.microsoft.com/dotnet/api/system.string)

The CSS class to generate styles for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[FormDesignCss](SuperOffice.WebApi.Data.FormDesignCss.md)\&gt;

Returns CSS properties for a single CSS class, and the internal state for the analyzer.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetFirstFormDesignCssFromUrlAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetFirstFormDesignCssFromUrlAsync(string, string, RequestOptions)

Starts a form design analysis from a URL, returning the properties for a single CSS class.

```csharp theme={null}
public Task<FormDesignCss> GetFirstFormDesignCssFromUrlAsync(string url, string cssClass, RequestOptions requestOptions = null)
```

#### Parameters

`url` [string](https://learn.microsoft.com/dotnet/api/system.string)

Url of the web page to extract style from.

`cssClass` [string](https://learn.microsoft.com/dotnet/api/system.string)

The CSS class to generate styles for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[FormDesignCss](SuperOffice.WebApi.Data.FormDesignCss.md)\&gt;

Returns CSS properties for a single CSS class, and the internal state for the analyzer.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetFormDesignCssFromImageAsync\_System\_Byte\_\_\_System\_String\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetFormDesignCssFromImageAsync(byte\[], string\[], RequestOptions)

Returns Form Designer CSS based on the look of a picture

```csharp theme={null}
public Task<FormDesignCarrier> GetFormDesignCssFromImageAsync(byte[] image, string[] cssClasses, RequestOptions requestOptions = null)
```

#### Parameters

`image` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Image data to analyze for design

`cssClasses` [string](https://learn.microsoft.com/dotnet/api/system.string)\[]

List of CSS classes to generate styles for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[FormDesignCarrier](SuperOffice.WebApi.Data.FormDesignCarrier.md)\&gt;

Returns CSS rules and confidence score.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetFormDesignCssFromUrlAsync\_System\_String\_System\_String\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetFormDesignCssFromUrlAsync(string, string\[], RequestOptions)

Returns Form Designer properties based on the look of a web page

```csharp theme={null}
public Task<FormDesignCarrier> GetFormDesignCssFromUrlAsync(string url, string[] cssClasses, RequestOptions requestOptions = null)
```

#### Parameters

`url` [string](https://learn.microsoft.com/dotnet/api/system.string)

Url of the web page to extract style from.

`cssClasses` [string](https://learn.microsoft.com/dotnet/api/system.string)\[]

List of CSS classes to generate styles for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[FormDesignCarrier](SuperOffice.WebApi.Data.FormDesignCarrier.md)\&gt;

Returns CSS rules and confidence score.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetFormDesignFromImageAsync\_System\_Byte\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetFormDesignFromImageAsync(byte\[], RequestOptions)

Returns Form Designer properties based on the look of a picture

```csharp theme={null}
public Task<StringDictionary> GetFormDesignFromImageAsync(byte[] image, RequestOptions requestOptions = null)
```

#### Parameters

`image` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Image data to analyze for design

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)\&gt;

Returns a Form Designer properties.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetFormDesignFromUrlAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetFormDesignFromUrlAsync(string, RequestOptions)

Returns Form Designer properties based on the look of a web page

```csharp theme={null}
public Task<StringDictionary> GetFormDesignFromUrlAsync(string url, RequestOptions requestOptions = null)
```

#### Parameters

`url` [string](https://learn.microsoft.com/dotnet/api/system.string)

Url of the web page to extract style from.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)\&gt;

Returns a Form Designer properties.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetIndexingStatusAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetIndexingStatusAsync(string, RequestOptions)

Get the current status.

```csharp theme={null}
public Task<RagStatus> GetIndexingStatusAsync(string namespaceName, RequestOptions requestOptions = null)
```

#### Parameters

`namespaceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Identifies the namespace to store content in.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[RagStatus](SuperOffice.WebApi.Data.RagStatus.md)\&gt;

Status of the indexing run - may be cancelled if another run is in progress.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetNextFormDesignCssAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetNextFormDesignCssAsync(string, string, RequestOptions)

Returns another CSS class, continuing the CSS generation, one class at a time.

```csharp theme={null}
public Task<FormDesignCss> GetNextFormDesignCssAsync(string state, string cssClass, RequestOptions requestOptions = null)
```

#### Parameters

`state` [string](https://learn.microsoft.com/dotnet/api/system.string)

Internal state from the analyzer, from the previous call.

`cssClass` [string](https://learn.microsoft.com/dotnet/api/system.string)

The CSS class to generate styles for.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[FormDesignCss](SuperOffice.WebApi.Data.FormDesignCss.md)\&gt;

Returns CSS properties for a single CSS class, and the updated internal state for the analyzer.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetSummarizeContactPromptAsync\_System\_Int32\_System\_Int32\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetSummarizeContactPromptAsync(int, int, string, string, RequestOptions)

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.

```csharp theme={null}
public Task<ChatbotTurn> GetSummarizeContactPromptAsync(int contactId, int numSentences, string summary, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`contactId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Contact id to summarize

`numSentences` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Length of summary

`summary` [string](https://learn.microsoft.com/dotnet/api/system.string)

Chatbot's summary of the contact activities

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in. Blank = do not specify language.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatbotTurn](SuperOffice.WebApi.Data.ChatbotTurn.md)\&gt;

Display text and Prompt used to generate a short summary of the activities on a contact.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetSummarizeSalePromptAsync\_System\_Int32\_System\_Int32\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetSummarizeSalePromptAsync(int, int, string, string, RequestOptions)

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.

```csharp theme={null}
public Task<ChatbotTurn> GetSummarizeSalePromptAsync(int saleId, int numSentences, string summary, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`saleId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Sale id to summarize

`numSentences` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Length of summary

`summary` [string](https://learn.microsoft.com/dotnet/api/system.string)

Chatbot's summary of the sale activities

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatbotTurn](SuperOffice.WebApi.Data.ChatbotTurn.md)\&gt;

Display text and Prompt used to generate a short summary of the activities on a sale.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetSummarizeTicketPromptAsync\_System\_Int32\_System\_Int32\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetSummarizeTicketPromptAsync(int, int, string, string, RequestOptions)

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.

```csharp theme={null}
public Task<ChatbotTurn> GetSummarizeTicketPromptAsync(int ticketId, int numSentences, string summary, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`ticketId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Ticket id to summarize

`numSentences` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Length of summary

`summary` [string](https://learn.microsoft.com/dotnet/api/system.string)

Chatbot's summary of the ticket

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ChatbotTurn](SuperOffice.WebApi.Data.ChatbotTurn.md)\&gt;

Display text and Prompt used to generate a short summary of the messages on a ticket.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GetTrainingStatusAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTrainingStatusAsync(RequestOptions)

Calling the HugoAI endpoint to fetch the current training status.

```csharp theme={null}
public Task<CategorizationStatusResponse> GetTrainingStatusAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CategorizationStatusResponse](SuperOffice.WebApi.Data.CategorizationStatusResponse.md)\&gt;

Carrier to describe the current status of HugoAI categorization

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_GuessCategoryAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GuessCategoryAsync(int, RequestOptions)

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

```csharp theme={null}
public Task<int> GuessCategoryAsync(int ticketId, RequestOptions requestOptions = null)
```

#### Parameters

`ticketId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of ticket to guess category for

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[int](https://learn.microsoft.com/dotnet/api/system.int32)\&gt;

Suggested ticket category ID

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_ParseQueryIntoRestrictionsAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_Data\_NaturalLanguageSearch\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ParseQueryIntoRestrictionsAsync(string, string, NaturalLanguageSearch, RequestOptions)

Return archive restrictions based on a natural language query.

```csharp theme={null}
public Task<NaturalLanguageSearch> ParseQueryIntoRestrictionsAsync(string query, string currents, NaturalLanguageSearch previousQuery, RequestOptions requestOptions = null)
```

#### Parameters

`query` [string](https://learn.microsoft.com/dotnet/api/system.string)

What the user asked for.

`currents` [string](https://learn.microsoft.com/dotnet/api/system.string)

Current context prompt. e.g. Current company name and id, what selection are we looking at?

`previousQuery` [NaturalLanguageSearch](SuperOffice.WebApi.Data.NaturalLanguageSearch.md)

Previous query, if applicable. NULL if no previous query.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[NaturalLanguageSearch](SuperOffice.WebApi.Data.NaturalLanguageSearch.md)\&gt;

Returns archive restrictions and columns for the query. Pass this result in as the previous query on the next call to continue the conversation.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_RemovePhotoBackgroundAsync\_System\_Byte\_\_\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RemovePhotoBackgroundAsync(byte\[], string, RequestOptions)

Returns an image with the background removed, leaving only the main subject

```csharp theme={null}
public Task<byte[]> RemovePhotoBackgroundAsync(byte[] image, string returnContentType = "application/octet-stream", RequestOptions requestOptions = null)
```

#### Parameters

`image` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Image to be cleaned. JPG or PNG.

`returnContentType` [string](https://learn.microsoft.com/dotnet/api/system.string)

Accept content-type. Default "application/octet-stream". Could also be "application/pdf", "text/plain", "text/html", or "multipart/related"

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]\&gt;

Image with background removed

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_RephraseTextAsync\_System\_String\_SuperOffice\_WebApi\_Data\_AiTextStyle\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RephraseTextAsync(string, AiTextStyle, string, RequestOptions)

Generate a new version of a text

```csharp theme={null}
public Task<string> RephraseTextAsync(string text, AiTextStyle style, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

Text to transform

`style` [AiTextStyle](SuperOffice.WebApi.Data.AiTextStyle.md)

New style to transform text into (Rephrase, Correct, Casual, Formal)

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in. Blank = do not specify language.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

New version of the text

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_SaveCopilotDataSourceEntityAsync\_SuperOffice\_WebApi\_Data\_CopilotDataSourceEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveCopilotDataSourceEntityAsync(CopilotDataSourceEntity, RequestOptions)

Updates the existing CopilotDataSourceEntity or creates a new CopilotDataSourceEntity if the id parameter is 0.

```csharp theme={null}
public Task<CopilotDataSourceEntity> SaveCopilotDataSourceEntityAsync(CopilotDataSourceEntity copilotDataSourceEntity, RequestOptions requestOptions = null)
```

#### Parameters

`copilotDataSourceEntity` [CopilotDataSourceEntity](SuperOffice.WebApi.Data.CopilotDataSourceEntity.md)

The CopilotDataSourceEntity that is saved.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CopilotDataSourceEntity](SuperOffice.WebApi.Data.CopilotDataSourceEntity.md)\&gt;

New or updated CopilotDataSourceEntity

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_SaveCopilotEntityAsync\_SuperOffice\_WebApi\_Data\_CopilotEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveCopilotEntityAsync(CopilotEntity, RequestOptions)

Updates the existing CopilotEntity or creates a new CopilotEntity if the id parameter is 0.

```csharp theme={null}
public Task<CopilotEntity> SaveCopilotEntityAsync(CopilotEntity copilotEntity, RequestOptions requestOptions = null)
```

#### Parameters

`copilotEntity` [CopilotEntity](SuperOffice.WebApi.Data.CopilotEntity.md)

The CopilotEntity that is saved.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CopilotEntity](SuperOffice.WebApi.Data.CopilotEntity.md)\&gt;

New or updated CopilotEntity

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_SearchAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_Data\_RagType\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SearchAsync(string, string, RagType, int, RequestOptions)

Returns semantic search results from vector database.

```csharp theme={null}
public Task<RagResult[]> SearchAsync(string namespaceName, string query, RagType type, int top, RequestOptions requestOptions = null)
```

#### Parameters

`namespaceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Defines the search domain. e.g. 'ServiceCopilot'.

`query` [string](https://learn.microsoft.com/dotnet/api/system.string)

Search query.

`type` [RagType](SuperOffice.WebApi.Data.RagType.md)

Filter results based on a specific content type. Default: None = no filtering

`top` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Max Number of results to return.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[RagResult](SuperOffice.WebApi.Data.RagResult.md)\[]\&gt;

Array containing vector search results

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_StartRagIndexingAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> StartRagIndexingAsync(string, string, RequestOptions)

Kicks off a batch task to update the RAG index

```csharp theme={null}
public Task<int> StartRagIndexingAsync(string namespaceName, string sourceId, RequestOptions requestOptions = null)
```

#### Parameters

`namespaceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Defines the search domain. e.g. 'ServiceCopilot'.

`sourceId` [string](https://learn.microsoft.com/dotnet/api/system.string)

(Optional) Identifies the data source to update. Blank = all sources

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[int](https://learn.microsoft.com/dotnet/api/system.int32)\&gt;

The batch task id

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_SummarizeContactAsync\_System\_Int32\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SummarizeContactAsync(int, int, string, RequestOptions)

Generate a short summary of the activities on a contact

```csharp theme={null}
public Task<string> SummarizeContactAsync(int contactId, int numSentences, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`contactId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Contact id to summarize

`numSentences` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Length of summary

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in. Blank = do not specify language.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Short summary of the activities on a contact - in HTML.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_SummarizeSaleAsync\_System\_Int32\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SummarizeSaleAsync(int, int, string, RequestOptions)

Generate a short summary of the activities on a sale

```csharp theme={null}
public Task<string> SummarizeSaleAsync(int saleId, int numSentences, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`saleId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Sale id to summarize

`numSentences` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Length of summary

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in. Blank = do not specify language.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Short summary of the activities on a sale - in HTML.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_SummarizeTextAsync\_System\_String\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SummarizeTextAsync(string, int, string, RequestOptions)

Generate a short summary of a text

```csharp theme={null}
public Task<string> SummarizeTextAsync(string text, int percentSmaller, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

Text to summarize

`percentSmaller` [int](https://learn.microsoft.com/dotnet/api/system.int32)

How much to shorten.

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in. Blank = do not specify language.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Short summary of the text

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_SummarizeTicketAsync\_System\_Int32\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SummarizeTicketAsync(int, int, string, RequestOptions)

Generate a short summary of the messages on a ticket

```csharp theme={null}
public Task<string> SummarizeTicketAsync(int ticketId, int numSentences, string isoLangCode, RequestOptions requestOptions = null)
```

#### Parameters

`ticketId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Ticket id to summarize

`numSentences` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Length of summary

`isoLangCode` [string](https://learn.microsoft.com/dotnet/api/system.string)

Language returned text should be in

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Short summary of the messages on a ticket - in HTML.

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_TrainCategoryGuesserAsync\_System\_Int32\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> TrainCategoryGuesserAsync(int, int, int, RequestOptions)

The category guesser training API will be called with an array of CategorizationTrainingItem during the (background, Batch) execution of this call

```csharp theme={null}
public Task<string> TrainCategoryGuesserAsync(int selectionId, int maxItems, int maxTextLength, RequestOptions requestOptions = null)
```

#### Parameters

`selectionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of selection of tickets, to retrieve training data from

`maxItems` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Maximum number of tickets to retrieve data from

`maxTextLength` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Maximum length of PlainTextBody or any other large text, truncated to nearest word boundary

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Placeholder for result...  should this be a BatchTaskId?  maybe not useful?

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_TranslateAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> TranslateAsync(string, string, RequestOptions)

Translate a text from one language to another. Language of the text is automatically detected.

```csharp theme={null}
public Task<string> TranslateAsync(string text, string targetLanguage, RequestOptions requestOptions = null)
```

#### Parameters

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

Text to be translated. Language of the text is automatically detected.

`targetLanguage` [string](https://learn.microsoft.com/dotnet/api/system.string)

ISO Language code (such as FR) to translate the text into

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Translated text

### \<a id="SuperOffice\_WebApi\_Agents\_AIAgent\_TranslateEntityAsync\_System\_String\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> TranslateEntityAsync(string, int, string, RequestOptions)

Retrieve, format and translate text for an entity to a specified language

```csharp theme={null}
public Task<string> TranslateEntityAsync(string entityName, int entityId, string targetLanguage, RequestOptions requestOptions = null)
```

#### Parameters

`entityName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Name of entity to get the text to be translated; eg., 'ticketMessage'

`entityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Identifier for the entity to get text to be translated

`targetLanguage` [string](https://learn.microsoft.com/dotnet/api/system.string)

ISO Language code (such as FR) to translate the text into

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

Translated text
