Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language Service Dependencyfix and authentication update #225

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions ai_services/language/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-ailanguage</artifactId>
<version>3.0.1</version>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<version>3.0.1</version>
<version>LATEST</version>
</dependency>
<dependency>
<!-- Since this is the "application" pom.xml, we do want to
choose the httpclient to use. -->
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common-httpclient-jersey</artifactId>
<version>3.0.1</version>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -36,16 +36,11 @@
<artifactId>slf4j-simple</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>groupId</groupId>
<artifactId>languagefromjava</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

</project>
</project>
17 changes: 15 additions & 2 deletions ai_services/language/java/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,29 @@ You can invoke OCI Language capabilities through the OCI SDKs.

Download and install the OCI Java SDK so you have access to the libraries you need to use, as described in [this article](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/javasdkgettingstarted.htm).

For the sample in this directory, I relied on Maven get the libraries I needed: **oci-java-sdk-ailanguage** and **oci-java-sdk-common**. This is what the dependencies sections looked like in my [pom.xml](pom.xml):
For the sample in this directory, I relied on Maven get the libraries I needed: **oci-java-sdk-ailanguage** , **oci-java-sdk-common** and **oci-java-sdk-common-httpclient-jersey**. This is what the dependencies sections looked like in my [pom.xml](pom.xml):

```xml
<dependencies>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-ailanguage</artifactId>
<version>2.12.0</version>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<!-- Since this is the "application" pom.xml, we do want to
choose the httpclient to use. -->
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common-httpclient-jersey</artifactId>
<version>LATEST</version>
</dependency>
</dependencies>

```

And this is what the imports looked like:
Expand Down Expand Up @@ -54,6 +62,11 @@ In order for your local code to have the rights to use your OCI services, it nee
new ConfigFileAuthenticationDetailsProvider(configFile);
```

OCI SDK provides some other Authentication methods as well and sample for these methods can found below in links below.
* Instance Principal Authentication - https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/InstancePrincipalsAuthenticationDetailsProviderExample.java
* Resource Principal Authentication - https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/FunctionsEphemeralResourcePrincipalAuthenticationDetailsProviderExample.java
* Simple Authentication - https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/SimpleAuthenticationDetailsProviderExample.java

## Using OCI Language from Java

Essentially, we just need to create a language client to issue the calls, prepare a request with its dependent object, and then send a request to the client, as shown in Steps 2,3 and 4 in the [Java sample code](https://github.com/oracle/oci-data-science-ai-samples/tree/master/ai_services/language/java/src/main/java/com/company).
Expand Down
Loading