You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**1**| Create an `.env` file containing an `AICORE_SERVICE_KEY={...}`|
70
-
|**2**| Regular service binding in SAP BTP Cloud Foundry (results in `VCAP_SERVICES` environment variable entry) |
71
-
|**3**| Define and use a _Destination_ in the SAP BTP Destination Service |
72
-
73
-
Additional methods (not recommended for production):
74
-
75
-
- Use the [hybrid testing](https://cap.cloud.sap/docs/advanced/hybrid-testing#services-on-cloud-foundry) approach for
76
-
CAP applications (e.g., `cds bind --to aicore --exec mvn spring-boot:run`)
77
-
- Leverage a "user-provided" service binding
78
-
- Define and use a custom `ServiceBinding` or `ServiceBindingAccessor` in your application
79
-
80
-
### Option 1: Set AI Core Credentials
81
-
82
-
<details>
83
-
<summary>Click to view detailed steps</summary>
84
-
85
-
86
-
**1. Obtain Service Credentials:**
87
-
88
-
- Log into the **SAP BTP Cockpit**
89
-
- Navigate to **Services** -> **Instances and Subscriptions** -> **Instances** -> **AI Core**
90
-
- Click **View Credentials** and copy the JSON content
91
-
92
-
**2. Create `.env` file:**
50
+
## Getting Started
93
51
94
-
- Create an `.env` file in the root directory of your application
95
-
- Add a **one line** entry `AICORE_SERVICE_KEY={...}` with the copied JSON
52
+
### What You'll Build
96
53
97
-
<details>
98
-
<summary>Set an environment variable instead of .env</summary>
54
+
In this quickstart, you'll use the OpenAI GPT-4o model through the [Orchestration Service of AI Core](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/orchestration) for generating text.
55
+
The application will send a prompt to the AI model and display the generated response.
99
56
100
-
**2. Set an Environment Variable: (alternative)**
57
+
### Prerequisites
101
58
102
-
- In your IDE or terminal, set the environment variable `AICORE_SERVICE_KEY` with the copied JSON content
59
+
This quickstart assumes you have a **deployment of the Orchestration service available** in the `default` resource group of your AI Core instance.
60
+
If you don't have a deployment yet, please refer to [this guide](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/create-deployment-for-orchestration) on how to create one.
103
61
104
-
ℹ️ The environment variable has priority over the `.env` file.
62
+
### Add the SDK as a Dependency
105
63
106
-
Example Linux/MacOS:
64
+
Add the following dependency to your `pom.xml` file:
### Option 2: Regular Service Binding in SAP BTP Cloud Foundry
122
-
123
-
<details>
124
-
<summary>Click to view detailed steps</summary>
125
-
126
-
127
-
**1. Bind an existing `aicore` service instance to your application**
75
+
### Use the Orchestration API
128
76
129
-
SAP BTP provides multiple ways to do this:
77
+
We'll use a `client`to interact with the Orchestration service:
130
78
131
-
- Using the web interface
132
-
- Using the CLI
133
-
- Using MTA or manifest files
134
-
135
-
[Learn more about binding service instances to applications](https://help.sap.com/docs/btp/sap-business-technology-platform/binding-service-instances-to-applications)
136
-
137
-
After restarting your application, you should see an "aicore" entry in the `VCAP_SERVICES` environment variable:
138
-
139
-
```json
140
-
{
141
-
"aicore": [
142
-
{
143
-
"clientid": "...",
144
-
"clientsecret": "...",
145
-
"url": "...",
146
-
"serviceurls": {
147
-
"AI_API_URL": "..."
148
-
}
149
-
}
150
-
]
151
-
}
79
+
```java
80
+
var client =newOrchestrationClient();
152
81
```
153
82
154
-
</details>
155
-
156
-
### Option 3: Define and Use a Destination
157
-
158
-
<details>
159
-
<summary>Click to view detailed steps</summary>
160
-
161
-
**1. Obtain Service Credentials:** (Same as in Option 1)
162
-
163
-
**2. Create a Destination:**
164
-
165
-
- In the **SAP BTP Cockpit**, go to **Connectivity** -> **Destinations**
When deploying your productive application to Cloud Foundry, it is recommended to use **service binding** to provide the AI Core credentials as per [Option 2](#option-2-regular-service-binding-in-sap-btp-cloud-foundry).
116
+
Please find **detailed instructions** and more examples [in this documentation](docs/guides/CONNECTING_TO_AICORE.md#using-the-aicore_service_key-environment-variable).
237
117
238
-
Build your application using Maven and deploy it to Cloud Foundry:
118
+
### Explore Further Capabilities
239
119
240
-
```shell
241
-
cf push
242
-
```
243
-
244
-
That's it!
245
-
Your application should now be running on Cloud Foundry, and the AI Core credentials are provided securely via service binding.
120
+
Check out the options available for the `OrchestrationPrompt` and `OrchestrationModuleConfig` classes.
121
+
You can use templating, content filtering, data masking and more.
122
+
Please refer to [this documentation](docs/guides/ORCHESTRATION_CHAT_COMPLETION.md) for more information.
246
123
247
124
## Documentation
248
125
249
126
For more detailed information and advanced usage, please refer to the following:
0 commit comments