|
| 1 | +# Integrate and Manage Generative AI Services |
| 2 | + |
| 3 | +Generative AI (GenAI) services leverage advanced machine learning models to create original content such as text, images, music, or code, by identifying and learning patterns from existing data. Powered by deep neural networks and other machine learning models, these services can generate human-like outputs in various formats. This versatility makes GenAI ideal for tasks such as content creation, image generation, conversation automation, etc. |
| 4 | + |
| 5 | +Choreo provides native support to integrate GenAI services into applications. Developers can register GenAI services, manage access, and expose them securely through the [Choreo AI Gateway](https://github.com/wso2/choreo-ai-gateway), ensuring enterprise-grade governance and control. |
| 6 | + |
| 7 | +## Register a GenAI Service |
| 8 | + |
| 9 | +When you register a GenAI service in Choreo, all invocations are automatically routed through the Choreo AI Gateway. The gateway enforces: |
| 10 | +- Security – Authentication, authorization, and secure transport. |
| 11 | +- Rate limiting – Request- and token-based throttling. |
| 12 | +- Observability – Metrics, logging, and monitoring for all requests (coming soon) |
| 13 | + |
| 14 | +This ensures consistent, secure, and cost-controlled access to the underlying GenAI provider. |
| 15 | + |
| 16 | +### Scopes of Registration |
| 17 | +GenAI services can be registered at two scopes: |
| 18 | + |
| 19 | +- **Organization-level registration**: The service is available across all projects within the organization. |
| 20 | +- **Project-level registration**: The service is restricted to the specific project where it is registered. |
| 21 | + |
| 22 | +Once registered, the service is published to the Internal Marketplace, where developers can discover and consume it via Connections. |
| 23 | + |
| 24 | +### Prerequisites |
| 25 | +Before registering a GenAI service, obtain the following details from the provider: |
| 26 | + |
| 27 | +- API key |
| 28 | +- Service URL |
| 29 | +- Any additional credentials (e.g., client secrets, subscription keys) |
| 30 | + |
| 31 | +!!! note |
| 32 | + - Register services at the correct scope: |
| 33 | + - Use organization-level if the service will be shared across projects. |
| 34 | + - Use project-level if usage is limited to a single project. |
| 35 | + |
| 36 | +### Step 1: Select a Service Provider |
| 37 | + |
| 38 | +1. Sign in to the [Choreo Console](https://console.choreo.dev). |
| 39 | +2. Select your Organization or Project depending on the required scope. |
| 40 | +3. In the left navigation menu, go to **DB & Services → GenAI Services**. |
| 41 | +4. Select a service provider: |
| 42 | + - **OpenAI** |
| 43 | + - **Azure OpenAI** |
| 44 | + - **Anthropic Claude** |
| 45 | + - **Mistral** |
| 46 | + - **AWS Bedrock** |
| 47 | + |
| 48 | +5. Click **Next**. |
| 49 | + |
| 50 | +### Step 2: Provide Service Details |
| 51 | + |
| 52 | +1. Under **Register a GenAI Service**, enter the following details: |
| 53 | + |
| 54 | + - **Name**: The name of the service. |
| 55 | + - **Context path**: A unique identifier for the service API within the Choreo AI Gateway. |
| 56 | + - **Service URL**: The provider’s endpoint. |
| 57 | + - **Summary**: A short description of the service. |
| 58 | + |
| 59 | +2. Click **Next**. |
| 60 | + |
| 61 | +### Step 3: Add Environment Configurations |
| 62 | + |
| 63 | +Under **Add Environment Configurations**, configure backend security and token-based rate limiting for your AI API. |
| 64 | + |
| 65 | +!!! note |
| 66 | +- Required configurations vary by provider. |
| 67 | +- You must provide valid configurations for all environments to complete registration. |
| 68 | + |
| 69 | +#### Configure Backend Security |
| 70 | + |
| 71 | +1. In the AI API Security section: |
| 72 | + |
| 73 | + - Set the Authorization header. |
| 74 | + - Provide the API key or credentials from your provider (e.g., `Authorization: Bearer <token>`). |
| 75 | + - Key formats may differ by provider. |
| 76 | + |
| 77 | +  |
| 78 | + |
| 79 | +#### Configure Token-Based Rate Limiting |
| 80 | + |
| 81 | +Unlike traditional APIs, LLMs and GenAI services are billed based on token consumption rather than just request count. Token-based rate limiting allows you to: |
| 82 | +- Control costs. |
| 83 | +- Prevent excessive usage. |
| 84 | +- Enforce fair quotas across consumers. |
| 85 | + |
| 86 | +2. In the **Token-Based Rate Limiting** section, configure the following parameters: |
| 87 | + - **Time Unit**: Window for quota enforcement (per minute, per hour, per day). |
| 88 | + - **Max Prompt Token Count**: Limit for input tokens per request. |
| 89 | + - **Max Completion Token Count**: Limit for output tokens per request. |
| 90 | + - **Max Total Token Count**: Combined input + output tokens per request. |
| 91 | + |
| 92 | +3. Click **Register**. |
| 93 | + |
| 94 | +The service is now available in the Internal Marketplace. |
| 95 | + |
| 96 | +### View or Update Service Details |
| 97 | + |
| 98 | +1. Sign in to the [Choreo Console](https://console.choreo.dev). |
| 99 | +2. Navigate to **DB & Services → GenAI Services**. |
| 100 | +3. Select a service to view or edit its details: |
| 101 | + |
| 102 | + - **General Details**: Displays metadata such as name, description, and labels.. |
| 103 | + - **Service Definition**: Displays the service definition. |
| 104 | + - **Environment Configurations**: Displays the security and rate-limiting settings for each environment, along with deployment status. |
| 105 | + |
| 106 | +  |
| 107 | + |
| 108 | +### Add a GenAI Service to the Internal Marketplace |
| 109 | + |
| 110 | +1. Sign in to the [Choreo Console](https://console.choreo.dev). |
| 111 | +2. Navigate to **DB & Services → GenAI Services**. |
| 112 | +3. Select the service. |
| 113 | +4. Click **Add to Marketplace**. |
| 114 | + |
| 115 | +### Remove a GenAI Service from the Internal Marketplace |
| 116 | + |
| 117 | +1. Sign in to the [Choreo Console](https://console.choreo.dev). |
| 118 | +2. Navigate to **DB & Services → GenAI Services**. |
| 119 | +3. Select the service. |
| 120 | +4. Click **Remove from Marketplace**. |
| 121 | + |
| 122 | +The service is removed from the Internal Marketplace, making it unavailable for new Connections. However, existing Connections continue to function until manually removed. |
| 123 | + |
| 124 | +## Manage GenAI Services |
| 125 | + |
| 126 | +### View or Update Service Details |
| 127 | + |
| 128 | +1. Sign in to the [Choreo Console](https://console.choreo.dev). |
| 129 | +2. Navigate to **DB & Services → GenAI Services**. |
| 130 | +3. Select a service to view or edit its details: |
| 131 | + |
| 132 | + - **General Details**: Displays service metadata. For example, the service name, overview, labels, etc. |
| 133 | + - **Service Definition**: Displays the service definition. To update the definition, click **Upload** and select the new definition file. |
| 134 | + - **Environment Configurations**: Displays the environment configurations for the service. To update the configurations, expand the environment and update the configurations. You can also view the deployment status of the AI API in the environment. |
| 135 | + |
| 136 | +### Add a GenAI Service to the Internal Marketplace |
| 137 | + |
| 138 | +1. Sign in to the [Choreo Console](https://console.choreo.dev). |
| 139 | +2. Navigate to **DB & Services → GenAI Services**. |
| 140 | +3. Select the service. |
| 141 | +4. Click **Add to Marketplace**. |
| 142 | + |
| 143 | +### Remove a GenAI Service from the Internal Marketplace |
| 144 | + |
| 145 | +1. Sign in to the [Choreo Console](https://console.choreo.dev). |
| 146 | +2. Navigate to **DB & Services → GenAI Services**. |
| 147 | +3. Select the service. |
| 148 | +4. Click **Remove from Marketplace**. |
| 149 | + |
| 150 | +The service is removed from the Internal Marketplace, making it unavailable for new Connections. However, existing Connections continue to function until manually removed. |
0 commit comments