> For the complete documentation index, see [llms.txt](https://docs.hos.accessacloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hos.accessacloud.com/atreemo-api/api-reference/atreemo-api-reference/api-open-ai.md).

# Api Open AI

Api Methods for ApiOpenAI

## AnalyzeEmailSpam

> Submits the supplied chat-completion request to the configured content-generation helper and returns its completion in ChatCompletionResponseOutput. The method name does not define a fixed spam score or verdict schema: the prompt and upstream response determine the generated content. Inspect ResponseStatus, Errors and ErrorMsg; generation can incur external processing and cost.

```json
{"openapi":"3.0.3","info":{"title":"Atreemo API","version":"0.1.0"},"tags":[{"name":"ApiOpenAI","description":"Api Methods for ApiOpenAI"}],"servers":[{"url":"https://apim-hospitality-dev-uksouth.azure-api.net/atreemo-api","description":"Local DEV APIM import draft only; not a deployed endpoint announcement."}],"security":[{"AtreemoBearer":[]}],"components":{"securitySchemes":{"AtreemoBearer":{"type":"http","scheme":"bearer","description":"Atreemo access token obtained by the caller from the Atreemo instance `POST /token` endpoint (OAuth2 password grant) and sent as `Authorization: Bearer <token>`. See the Authorisation guide."}},"schemas":{"ChatCompletionRequest":{"type":"object","nullable":true,"properties":{"model":{"type":"string","nullable":true},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Messages"},"nullable":true},"temperature":{"type":"number","format":"float"},"top_p":{"type":"number","format":"float"},"n":{"type":"integer","format":"int32"},"max_tokens":{"type":"integer","format":"int32","nullable":true},"tools":{"type":"array","items":{"description":"Arbitrary JSON value: source declares dynamic; no fixed property contract is imposed."},"nullable":true},"tool_choice":{"description":"Arbitrary JSON value: source declares object; no fixed property contract is imposed."}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Messages":{"type":"object","nullable":true,"properties":{"role":{"type":"string","nullable":true},"content":{"description":"Arbitrary JSON value: source declares object; no fixed property contract is imposed."}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ChatCompletionResponseOutput":{"type":"object","nullable":true,"properties":{"ChatCompletionResponse":{"allOf":[{"$ref":"#/components/schemas/ChatCompletionResponse"}]},"ErrorMsg":{"type":"string","nullable":true}},"allOf":[{"$ref":"#/components/schemas/ApiCallResponse"}],"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ChatCompletionResponse":{"type":"object","nullable":true,"properties":{"Id":{"type":"string","nullable":true},"Created":{"type":"integer","format":"int32"},"Model":{"type":"string","nullable":true},"system_fingerprint":{"type":"string","nullable":true},"Choices":{"type":"array","items":{"$ref":"#/components/schemas/Choice"},"nullable":true},"prompt_filter_results":{"type":"array","items":{"$ref":"#/components/schemas/PromptFilterResult"},"nullable":true},"Usage":{"allOf":[{"$ref":"#/components/schemas/Usage"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Choice":{"type":"object","nullable":true,"properties":{"Message":{"allOf":[{"$ref":"#/components/schemas/Message"}]},"Index":{"type":"integer","format":"int64"},"finish_reason":{"type":"string","nullable":true},"content_filter_results":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResults"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Message":{"type":"object","nullable":true,"properties":{"Role":{"type":"string","nullable":true},"Content":{"type":"string","nullable":true},"tool_calls":{"type":"array","items":{"$ref":"#/components/schemas/ToolCall"},"nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ToolCall":{"type":"object","nullable":true,"properties":{"function":{"allOf":[{"$ref":"#/components/schemas/Function"}]},"id":{"type":"string","nullable":true},"type":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Function":{"type":"object","nullable":true,"properties":{"arguments":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterResults":{"type":"object","nullable":true,"properties":{"Sexual":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"Violence":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"Hate":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"self_harm":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"profanity":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"jailbreak":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"custom_blocklists":{"allOf":[{"$ref":"#/components/schemas/ContentFilterBlocklistIdResult"}]},"protected_material_text":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"protected_material_code":{"allOf":[{"$ref":"#/components/schemas/ContentFilterCitedDetectionResult"}]},"Error":{"allOf":[{"$ref":"#/components/schemas/ResponseError"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterResult":{"type":"object","nullable":true,"properties":{"Severity":{"type":"string","nullable":true},"Filtered":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterDetectionResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"detected":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterBlocklistIdResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"id":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterCitedDetectionResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"detected":{"type":"boolean"},"Citation":{"allOf":[{"$ref":"#/components/schemas/ContentFilterCited"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterCited":{"type":"object","nullable":true,"properties":{"URL":{"type":"string","nullable":true},"license":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ResponseError":{"type":"object","nullable":true,"properties":{"Code":{"type":"string","nullable":true,"readOnly":true},"Message":{"type":"string","nullable":true,"readOnly":true}},"description":"Azure.Core 1.46.1 ResponseError has public getters Code and Message. Its System.Text.Json converter is not a Newtonsoft.Json converter; Web API Json.NET serializes these PascalCase public properties, not the converter's lowercase input keys. InnerError, Target and Details are internal. Runtime-unverified."},"PromptFilterResult":{"type":"object","nullable":true,"properties":{"prompt_index":{"type":"integer","format":"int64"},"content_filter_results":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResults"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Usage":{"type":"object","nullable":true,"properties":{"completion_tokens":{"type":"integer","format":"int64"},"prompt_tokens":{"type":"integer","format":"int64"},"total_tokens":{"type":"integer","format":"int64"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ApiCallResponse":{"type":"object","properties":{"Errors":{"type":"array","items":{"$ref":"#/components/schemas/APICallError"},"description":"Collection of errors if exist"},"ResponseStatus":{"type":"boolean","description":"True: if the action was succsessfully treated False: if there is an error"}}},"APICallError":{"type":"object","properties":{"ErrorCode":{"type":"integer","format":"int32","description":"The error code"},"ErrorDescription":{"type":"string","description":"The error description"}}}}},"paths":{"/api/ApiOpenAI/AnalyzeEmailSpam":{"post":{"operationId":"ApiOpenAiAnalyzeEmailSpam","summary":"AnalyzeEmailSpam","tags":["ApiOpenAI"],"description":"Submits the supplied chat-completion request to the configured content-generation helper and returns its completion in ChatCompletionResponseOutput. The method name does not define a fixed spam score or verdict schema: the prompt and upstream response determine the generated content. Inspect ResponseStatus, Errors and ErrorMsg; generation can incur external processing and cost.","parameters":[{"name":"SourceID","in":"query","schema":{"type":"integer","format":"int32"},"description":"Native query parameter. CLR int SourceID in the pinned controller signature.","required":true},{"name":"Subscription_Key","in":"query","schema":{"type":"string","nullable":true},"description":"Native query parameter. CLR string Subscription_Key in the pinned controller signature.","required":true},{"name":"FunctionName","in":"query","schema":{"type":"string","nullable":true},"description":"Native query parameter. CLR string FunctionName in the pinned controller signature.","required":true},{"name":"SourceObjectID","in":"query","schema":{"type":"integer","format":"int32","nullable":true},"description":"Native query parameter. CLR int? SourceObjectID in the pinned controller signature.","required":true}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}}},"responses":{"200":{"description":"Source return path at pinned commit; runtime and deployed-version alignment unverified.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponseOutput"}}}}}}}}}
```

## GenerateCampaignSubject

> Generates a campaign subject using OpenAI's chat completion API.

```json
{"openapi":"3.0.3","info":{"title":"Atreemo API","version":"0.1.0"},"tags":[{"name":"ApiOpenAI","description":"Api Methods for ApiOpenAI"}],"servers":[{"url":"https://apim-hospitality-dev-uksouth.azure-api.net/atreemo-api","description":"Local DEV APIM import draft only; not a deployed endpoint announcement."}],"security":[{"AtreemoBearer":[]}],"components":{"securitySchemes":{"AtreemoBearer":{"type":"http","scheme":"bearer","description":"Atreemo access token obtained by the caller from the Atreemo instance `POST /token` endpoint (OAuth2 password grant) and sent as `Authorization: Bearer <token>`. See the Authorisation guide."}},"schemas":{"ChatCompletionRequest":{"type":"object","nullable":true,"properties":{"model":{"type":"string","nullable":true},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Messages"},"nullable":true},"temperature":{"type":"number","format":"float"},"top_p":{"type":"number","format":"float"},"n":{"type":"integer","format":"int32"},"max_tokens":{"type":"integer","format":"int32","nullable":true},"tools":{"type":"array","items":{"description":"Arbitrary JSON value: source declares dynamic; no fixed property contract is imposed."},"nullable":true},"tool_choice":{"description":"Arbitrary JSON value: source declares object; no fixed property contract is imposed."}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Messages":{"type":"object","nullable":true,"properties":{"role":{"type":"string","nullable":true},"content":{"description":"Arbitrary JSON value: source declares object; no fixed property contract is imposed."}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ChatCompletionResponseOutput":{"type":"object","nullable":true,"properties":{"ChatCompletionResponse":{"allOf":[{"$ref":"#/components/schemas/ChatCompletionResponse"}]},"ErrorMsg":{"type":"string","nullable":true}},"allOf":[{"$ref":"#/components/schemas/ApiCallResponse"}],"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ChatCompletionResponse":{"type":"object","nullable":true,"properties":{"Id":{"type":"string","nullable":true},"Created":{"type":"integer","format":"int32"},"Model":{"type":"string","nullable":true},"system_fingerprint":{"type":"string","nullable":true},"Choices":{"type":"array","items":{"$ref":"#/components/schemas/Choice"},"nullable":true},"prompt_filter_results":{"type":"array","items":{"$ref":"#/components/schemas/PromptFilterResult"},"nullable":true},"Usage":{"allOf":[{"$ref":"#/components/schemas/Usage"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Choice":{"type":"object","nullable":true,"properties":{"Message":{"allOf":[{"$ref":"#/components/schemas/Message"}]},"Index":{"type":"integer","format":"int64"},"finish_reason":{"type":"string","nullable":true},"content_filter_results":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResults"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Message":{"type":"object","nullable":true,"properties":{"Role":{"type":"string","nullable":true},"Content":{"type":"string","nullable":true},"tool_calls":{"type":"array","items":{"$ref":"#/components/schemas/ToolCall"},"nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ToolCall":{"type":"object","nullable":true,"properties":{"function":{"allOf":[{"$ref":"#/components/schemas/Function"}]},"id":{"type":"string","nullable":true},"type":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Function":{"type":"object","nullable":true,"properties":{"arguments":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterResults":{"type":"object","nullable":true,"properties":{"Sexual":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"Violence":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"Hate":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"self_harm":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"profanity":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"jailbreak":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"custom_blocklists":{"allOf":[{"$ref":"#/components/schemas/ContentFilterBlocklistIdResult"}]},"protected_material_text":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"protected_material_code":{"allOf":[{"$ref":"#/components/schemas/ContentFilterCitedDetectionResult"}]},"Error":{"allOf":[{"$ref":"#/components/schemas/ResponseError"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterResult":{"type":"object","nullable":true,"properties":{"Severity":{"type":"string","nullable":true},"Filtered":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterDetectionResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"detected":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterBlocklistIdResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"id":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterCitedDetectionResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"detected":{"type":"boolean"},"Citation":{"allOf":[{"$ref":"#/components/schemas/ContentFilterCited"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterCited":{"type":"object","nullable":true,"properties":{"URL":{"type":"string","nullable":true},"license":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ResponseError":{"type":"object","nullable":true,"properties":{"Code":{"type":"string","nullable":true,"readOnly":true},"Message":{"type":"string","nullable":true,"readOnly":true}},"description":"Azure.Core 1.46.1 ResponseError has public getters Code and Message. Its System.Text.Json converter is not a Newtonsoft.Json converter; Web API Json.NET serializes these PascalCase public properties, not the converter's lowercase input keys. InnerError, Target and Details are internal. Runtime-unverified."},"PromptFilterResult":{"type":"object","nullable":true,"properties":{"prompt_index":{"type":"integer","format":"int64"},"content_filter_results":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResults"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Usage":{"type":"object","nullable":true,"properties":{"completion_tokens":{"type":"integer","format":"int64"},"prompt_tokens":{"type":"integer","format":"int64"},"total_tokens":{"type":"integer","format":"int64"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ApiCallResponse":{"type":"object","properties":{"Errors":{"type":"array","items":{"$ref":"#/components/schemas/APICallError"},"description":"Collection of errors if exist"},"ResponseStatus":{"type":"boolean","description":"True: if the action was succsessfully treated False: if there is an error"}}},"APICallError":{"type":"object","properties":{"ErrorCode":{"type":"integer","format":"int32","description":"The error code"},"ErrorDescription":{"type":"string","description":"The error description"}}}}},"paths":{"/api/ApiOpenAI/GenerateCampaignSubject":{"post":{"operationId":"ApiOpenAiGenerateCampaignSubject","summary":"GenerateCampaignSubject","tags":["ApiOpenAI"],"description":"Generates a campaign subject using OpenAI's chat completion API.","parameters":[{"name":"SourceID","in":"query","schema":{"type":"integer","format":"int32"},"description":"Native query parameter. CLR int SourceID in the pinned controller signature.","required":true},{"name":"Subscription_Key","in":"query","schema":{"type":"string","nullable":true},"description":"Native query parameter. CLR string Subscription_Key in the pinned controller signature.","required":true},{"name":"FunctionName","in":"query","schema":{"type":"string","nullable":true},"description":"Native query parameter. CLR string FunctionName in the pinned controller signature.","required":true},{"name":"SourceObjectID","in":"query","schema":{"type":"integer","format":"int32","nullable":true},"description":"Native query parameter. CLR int? SourceObjectID in the pinned controller signature.","required":true},{"name":"usingTools","in":"query","schema":{"type":"boolean","default":false},"description":"Native query parameter. CLR bool usingTools in the pinned controller signature. Omission uses the declared default.","required":false}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}}},"responses":{"200":{"description":"Source return path at pinned commit; runtime and deployed-version alignment unverified.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponseOutput"}}}}}}}}}
```

## GenerateRFMSegmentMovement

> Generates RFM Segment Movement Summary using OpenAI's chat completion API.

```json
{"openapi":"3.0.3","info":{"title":"Atreemo API","version":"0.1.0"},"tags":[{"name":"ApiOpenAI","description":"Api Methods for ApiOpenAI"}],"servers":[{"url":"https://apim-hospitality-dev-uksouth.azure-api.net/atreemo-api","description":"Local DEV APIM import draft only; not a deployed endpoint announcement."}],"security":[{"AtreemoBearer":[]}],"components":{"securitySchemes":{"AtreemoBearer":{"type":"http","scheme":"bearer","description":"Atreemo access token obtained by the caller from the Atreemo instance `POST /token` endpoint (OAuth2 password grant) and sent as `Authorization: Bearer <token>`. See the Authorisation guide."}},"schemas":{"ChatCompletionRequest":{"type":"object","nullable":true,"properties":{"model":{"type":"string","nullable":true},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Messages"},"nullable":true},"temperature":{"type":"number","format":"float"},"top_p":{"type":"number","format":"float"},"n":{"type":"integer","format":"int32"},"max_tokens":{"type":"integer","format":"int32","nullable":true},"tools":{"type":"array","items":{"description":"Arbitrary JSON value: source declares dynamic; no fixed property contract is imposed."},"nullable":true},"tool_choice":{"description":"Arbitrary JSON value: source declares object; no fixed property contract is imposed."}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Messages":{"type":"object","nullable":true,"properties":{"role":{"type":"string","nullable":true},"content":{"description":"Arbitrary JSON value: source declares object; no fixed property contract is imposed."}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ChatCompletionResponseOutput":{"type":"object","nullable":true,"properties":{"ChatCompletionResponse":{"allOf":[{"$ref":"#/components/schemas/ChatCompletionResponse"}]},"ErrorMsg":{"type":"string","nullable":true}},"allOf":[{"$ref":"#/components/schemas/ApiCallResponse"}],"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ChatCompletionResponse":{"type":"object","nullable":true,"properties":{"Id":{"type":"string","nullable":true},"Created":{"type":"integer","format":"int32"},"Model":{"type":"string","nullable":true},"system_fingerprint":{"type":"string","nullable":true},"Choices":{"type":"array","items":{"$ref":"#/components/schemas/Choice"},"nullable":true},"prompt_filter_results":{"type":"array","items":{"$ref":"#/components/schemas/PromptFilterResult"},"nullable":true},"Usage":{"allOf":[{"$ref":"#/components/schemas/Usage"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Choice":{"type":"object","nullable":true,"properties":{"Message":{"allOf":[{"$ref":"#/components/schemas/Message"}]},"Index":{"type":"integer","format":"int64"},"finish_reason":{"type":"string","nullable":true},"content_filter_results":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResults"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Message":{"type":"object","nullable":true,"properties":{"Role":{"type":"string","nullable":true},"Content":{"type":"string","nullable":true},"tool_calls":{"type":"array","items":{"$ref":"#/components/schemas/ToolCall"},"nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ToolCall":{"type":"object","nullable":true,"properties":{"function":{"allOf":[{"$ref":"#/components/schemas/Function"}]},"id":{"type":"string","nullable":true},"type":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Function":{"type":"object","nullable":true,"properties":{"arguments":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterResults":{"type":"object","nullable":true,"properties":{"Sexual":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"Violence":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"Hate":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"self_harm":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResult"}]},"profanity":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"jailbreak":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"custom_blocklists":{"allOf":[{"$ref":"#/components/schemas/ContentFilterBlocklistIdResult"}]},"protected_material_text":{"allOf":[{"$ref":"#/components/schemas/ContentFilterDetectionResult"}]},"protected_material_code":{"allOf":[{"$ref":"#/components/schemas/ContentFilterCitedDetectionResult"}]},"Error":{"allOf":[{"$ref":"#/components/schemas/ResponseError"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterResult":{"type":"object","nullable":true,"properties":{"Severity":{"type":"string","nullable":true},"Filtered":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterDetectionResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"detected":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterBlocklistIdResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"id":{"type":"string","nullable":true}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterCitedDetectionResult":{"type":"object","nullable":true,"properties":{"filtered":{"type":"string","nullable":true},"detected":{"type":"boolean"},"Citation":{"allOf":[{"$ref":"#/components/schemas/ContentFilterCited"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ContentFilterCited":{"type":"object","nullable":true,"properties":{"URL":{"type":"string","nullable":true},"license":{"type":"boolean"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ResponseError":{"type":"object","nullable":true,"properties":{"Code":{"type":"string","nullable":true,"readOnly":true},"Message":{"type":"string","nullable":true,"readOnly":true}},"description":"Azure.Core 1.46.1 ResponseError has public getters Code and Message. Its System.Text.Json converter is not a Newtonsoft.Json converter; Web API Json.NET serializes these PascalCase public properties, not the converter's lowercase input keys. InnerError, Target and Details are internal. Runtime-unverified."},"PromptFilterResult":{"type":"object","nullable":true,"properties":{"prompt_index":{"type":"integer","format":"int64"},"content_filter_results":{"allOf":[{"$ref":"#/components/schemas/ContentFilterResults"}]}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"Usage":{"type":"object","nullable":true,"properties":{"completion_tokens":{"type":"integer","format":"int64"},"prompt_tokens":{"type":"integer","format":"int64"},"total_tokens":{"type":"integer","format":"int64"}},"description":"Source-backed JSON members, including inheritance and JSON naming/ignore attributes. No property is required solely because its CLR value type is non-nullable. Runtime and deployment alignment are unverified."},"ApiCallResponse":{"type":"object","properties":{"Errors":{"type":"array","items":{"$ref":"#/components/schemas/APICallError"},"description":"Collection of errors if exist"},"ResponseStatus":{"type":"boolean","description":"True: if the action was succsessfully treated False: if there is an error"}}},"APICallError":{"type":"object","properties":{"ErrorCode":{"type":"integer","format":"int32","description":"The error code"},"ErrorDescription":{"type":"string","description":"The error description"}}}}},"paths":{"/api/ApiOpenAI/GenerateRFMSegmentMovement":{"post":{"operationId":"ApiOpenAiGenerateRfmSegmentMovement","summary":"GenerateRFMSegmentMovement","tags":["ApiOpenAI"],"description":"Generates RFM Segment Movement Summary using OpenAI's chat completion API.","parameters":[{"name":"SourceID","in":"query","schema":{"type":"integer","format":"int32"},"description":"Native query parameter. CLR int SourceID in the pinned controller signature.","required":true},{"name":"Subscription_Key","in":"query","schema":{"type":"string","nullable":true},"description":"Native query parameter. CLR string Subscription_Key in the pinned controller signature.","required":true},{"name":"FunctionName","in":"query","schema":{"type":"string","nullable":true},"description":"Native query parameter. CLR string FunctionName in the pinned controller signature.","required":true},{"name":"SourceObjectID","in":"query","schema":{"type":"integer","format":"int32","nullable":true},"description":"Native query parameter. CLR int? SourceObjectID in the pinned controller signature.","required":true}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}}},"responses":{"200":{"description":"Source return path at pinned commit; runtime and deployed-version alignment unverified.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponseOutput"}}}}}}}}}
```

## GetEngagementAIAnalysis

> Obtains engagement metrics for the requested user, brand and optional client/day inputs, then requests and formats AI analysis. The response projects metric strings and AIAnalysis under data. This GET performs external generation and logging, not merely a cached read. The returned success flag is not proof that every metric or upstream analysis was populated.

```json
{"openapi":"3.0.3","info":{"title":"Atreemo API","version":"0.1.0"},"tags":[{"name":"ApiOpenAI","description":"Api Methods for ApiOpenAI"}],"servers":[{"url":"https://apim-hospitality-dev-uksouth.azure-api.net/atreemo-api","description":"Local DEV APIM import draft only; not a deployed endpoint announcement."}],"security":[{"AtreemoBearer":[]}],"components":{"securitySchemes":{"AtreemoBearer":{"type":"http","scheme":"bearer","description":"Atreemo access token obtained by the caller from the Atreemo instance `POST /token` endpoint (OAuth2 password grant) and sent as `Authorization: Bearer <token>`. See the Authorisation guide."}},"schemas":{"EngagementAIAnalysisOutput":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/EngagementAIAnalysisData"}}},"EngagementAIAnalysisData":{"type":"object","description":"The controller projects eight string-valued metrics into these native mixed-case names. Counts and percentages are JSON strings, not asserted numeric formats. Reference values may be null; no fixed unit, locale or presence guarantee is inferred.","properties":{"count_Auto":{"type":"string","nullable":true},"count_Adhoc":{"type":"string","nullable":true},"CountRecipients":{"type":"string","nullable":true},"CountNew":{"type":"string","nullable":true},"DBgrowthPercent":{"type":"string","nullable":true},"avg_open_rate":{"type":"string","nullable":true},"avg_click_rate":{"type":"string","nullable":true},"total_clicks":{"type":"string","nullable":true},"AIAnalysis":{"type":"string","description":"HTML-formatted analysis string; do not render untrusted HTML without sanitisation."}}}}},"paths":{"/api/OpenAI/GetEngagementAIAnalysis":{"get":{"operationId":"ApiOpenAiGetEngagementAiAnalysis","summary":"GetEngagementAIAnalysis","tags":["ApiOpenAI"],"description":"Obtains engagement metrics for the requested user, brand and optional client/day inputs, then requests and formats AI analysis. The response projects metric strings and AIAnalysis under data. This GET performs external generation and logging, not merely a cached read. The returned success flag is not proof that every metric or upstream analysis was populated.","parameters":[{"name":"UserID","in":"query","schema":{"type":"integer","format":"int32"},"description":"Native query parameter. CLR int UserID in the pinned controller signature.","required":true},{"name":"BrandID","in":"query","schema":{"type":"integer","format":"int32"},"description":"Native query parameter. CLR int BrandID in the pinned controller signature.","required":true},{"name":"ClientID","in":"query","schema":{"type":"integer","format":"int32","nullable":true},"description":"Native query parameter. CLR int? ClientID in the pinned controller signature. Omission uses the declared default.","required":false},{"name":"NbDaysSinceLastRun","in":"query","schema":{"type":"integer","format":"int32","nullable":true},"description":"Native query parameter. CLR int? NbDaysSinceLastRun in the pinned controller signature. Omission uses the declared default.","required":false}],"responses":{"200":{"description":"Source return path at pinned commit; runtime and deployed-version alignment unverified.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngagementAIAnalysisOutput"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hos.accessacloud.com/atreemo-api/api-reference/atreemo-api-reference/api-open-ai.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
