Skip to content

Commit

Permalink
Java: Add Gemini ChatCompletion and HuggingFace (#6023)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: John Oliver <[email protected]>
  • Loading branch information
milderhc and johnoliver committed Jun 4, 2024
1 parent 0778efc commit d1b1bc7
Show file tree
Hide file tree
Showing 55 changed files with 3,185 additions and 147 deletions.
59 changes: 59 additions & 0 deletions java/aiservices/google/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.semantic-kernel</groupId>
<artifactId>semantickernel-parent</artifactId>
<version>1.1.6-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>semantickernel-aiservices-google</artifactId>
<name>Semantic Kernel Google Services</name>
<description>Google services for Semantic Kernel</description>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.37.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-vertexai</artifactId>
</dependency>

<dependency>
<groupId>com.microsoft.semantic-kernel</groupId>
<artifactId>semantickernel-api</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<scope>compile</scope>
</dependency>

<!-- Required for Android -->
<dependency>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft. All rights reserved.
package com.microsoft.semantickernel.aiservices.google;

import com.google.cloud.vertexai.VertexAI;
import com.microsoft.semantickernel.services.AIService;

import javax.annotation.Nullable;

public class GeminiService implements AIService {
private final VertexAI client;
private final String modelId;

protected GeminiService(VertexAI client, String modelId) {
this.client = client;
this.modelId = modelId;
}

@Nullable
@Override
public String getModelId() {
return modelId;
}

@Nullable
@Override
public String getServiceId() {
return null;
}

protected VertexAI getClient() {
return client;
}
}
Loading

0 comments on commit d1b1bc7

Please sign in to comment.