Skip to content

Commit 21b0d7c

Browse files
OCI GenAI README (#46)
Signed-off-by: Anders Swanson <anders.swanson@oracle.com>
1 parent 34e2eee commit 21b0d7c

File tree

3 files changed

+85
-10
lines changed

3 files changed

+85
-10
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,11 @@ This project has dependency and transitive dependencies on Spring Projects. The
2828
| 1.0.1 | 2023.0.x | 3.2.x | 3.41.1 |
2929
| 1.1.0 | 2023.0.x | 3.2.x | 3.41.1 |
3030

31-
## Try out samples
31+
## Sample applications
3232

3333
Samples for each service supported by Spring Cloud OCI below:
3434

35-
* [OCI Storage Sample](spring-cloud-oci-samples/spring-cloud-oci-storage-sample/README.md)
36-
* [OCI Notification Service Sample](spring-cloud-oci-samples/spring-cloud-oci-notification-sample/README.md)
37-
* [OCI Logging Service Sample](spring-cloud-oci-samples/spring-cloud-oci-logging-sample/README.md)
38-
35+
* [Application Samples](spring-cloud-oci-samples)
3936
## Checking out and building
4037

4138
If you like to clone this repo in your OCI tenancy, click on 'Open in Code Editor' button below to clone and launch OCI Code Editor for this sample.

spring-cloud-oci-samples/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
# Spring Cloud OCI - Samples
22

3-
Each code sample in this folder exemplifies how to use one Spring Framework with OCI.
4-
5-
* [OCI Storage Service Sample](./spring-cloud-oci-storage-sample/)
6-
* [OCI Notification Service Sample](./spring-cloud-oci-notification-sample/)
7-
* [OCI Logging Service Sample](./spring-cloud-oci-logging-sample/)
3+
The code samples in this directory demonstrate how to use the services supported by Spring Cloud OCI.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# OCI Generative AI - Spring Cloud OCI Sample
2+
3+
This sample demonstrates getting started quickly with Spring Cloud OCI to work with Oracle Cloud Infrastructure (OCI) Generative AI Service. This sample implements simple REST service which internally uses Spring Cloud OCI Generate AI APIs.
4+
5+
## What is Spring Cloud OCI?
6+
7+
Spring Cloud for OCI, eases the integration of OCI services with the help of internal OCI Java SDK. It offers a convenient way to interact with OCI-provided services using well-known Spring idioms and APIs, such as the messaging or storage API. Developers can build applications around the hosted services without concern for infrastructure or maintenance. Spring Cloud for OCI contains autoconfiguration support for OCI-managed services.
8+
9+
## What is OCI Generative AI?
10+
11+
Generative AI is a fully managed Oracle Cloud Infrastructure service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases, including chat, text generation, summarization, and creating text embeddings.
12+
13+
## Prerequisites
14+
Configuration items that are needed to run the Application can be configured in `application.properties`.
15+
16+
* `spring.cloud.oci.region.static` - OCI Region name(Ex: us-phoenix-1) where the OCI resources need to be created.
17+
* `spring.cloud.oci.config.type` - Authentication type to be used for OCI. It could be one of the following: RESOURCE_PRINCIPAL, INSTANCE_PRINCIPAL, SESSION_TOKEN, SIMPLE, FILE, and WORKLOAD_IDENTITY. If nothing is specified, FILE type is used by default.
18+
* `spring.cloud.oci.config.file` - The file path set to this property will be used as the configuration file for FILE type authentication which uses the OCI configuration file. If nothing is specified, the OCI configuration file from the user's home directory will be used.
19+
* `spring.cloud.oci.config.profile` - Profile to be used in the OCI config file for Authentication. If a profile is not specified, a DEFAULT profile will be used.
20+
21+
If the `spring.cloud.oci.config.type` is SIMPLE, then the following properties also need to be set in the `application.properties`.
22+
23+
* `spring.cloud.oci.config.userId`
24+
* `spring.cloud.oci.config.tenantId`
25+
* `spring.cloud.oci.config.fingerprint`
26+
* `spring.cloud.oci.config.privateKey`
27+
* `spring.cloud.oci.config.passPhrase`
28+
* `spring.cloud.oci.config.region`
29+
30+
Refer to [OCI SDK Authentication Methods](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdk_authentication_methods.htm) for more details on the Authentication types supported by OCI.
31+
32+
## Quick Launch
33+
34+
Clone the repository manually with the following instructions:
35+
36+
```
37+
git clone https://github.com/oracle/spring-cloud-oci.git spring-cloud-oci
38+
```
39+
40+
## Getting Started
41+
42+
1. Run `mvn clean install` from the root directory of the repository code.
43+
44+
1. Set appropriate values at `application.properties` for the following properties. (Refer to the Spring Cloud OCI docs for more details.)
45+
```
46+
spring.cloud.oci.region.static = US_ASHBURN_1
47+
48+
spring.cloud.oci.genai.embedding.compartment = ${OCI_COMPARTMENT_ID}
49+
spring.cloud.oci.genai.chat.compartment = ${OCI_COMPARTMENT_ID}
50+
51+
spring.cloud.oci.genai.chat.onDemandModelId = ${OCI_CHAT_MODEL_ID}
52+
spring.cloud.oci.genai.embedding.onDemandModelId = ${OCI_EMBEDDING_MODEL_ID}
53+
```
54+
1. Start the application using the following command from sample root directory.
55+
```
56+
mvn spring-boot:run
57+
```
58+
59+
Note: Default service port is `8080`. You can change this with the `server.port` property.
60+
61+
## Sample Application API Reference
62+
63+
Launch the Swagger UI (http://localhost:8080/swagger-ui/index.html) to view all available APIs and their payload samples.
64+
65+
![Swagger UI](./images/swagger-ui.png)
66+
67+
## References
68+
* [Spring Cloud OCI - Documentation](#)
69+
* [Spring Cloud OCI - Open Source](https://github.com/oracle/spring-cloud-oci)
70+
* [OCI SDK - Documentation](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdks.htm)
71+
72+
## Contributing
73+
This project is open source. Submit your contributions by forking this repository and submitting a pull request. Oracle appreciates any contributions that are made by the open source community.
74+
75+
## License
76+
Copyright (c) 2024 Oracle and/or its affiliates.
77+
78+
Licensed under the Universal Permissive License (UPL), Version 1.0.
79+
80+
See [LICENSE](../../LICENSE.txt) for more details.
81+
82+
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.

0 commit comments

Comments
 (0)