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

Sync wasm variant with v0.5.0 #9

Merged
merged 49 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
bd5f554
Update sample app to use v0.2.2 (#83)
rlazo Mar 14, 2024
c53879d
Merge pull request #6 from PatilShreyas/v0.2.2-kmp
PatilShreyas Mar 16, 2024
39396f0
Common & genai sdk split (#88)
rlazo Mar 20, 2024
4638406
Expand RequestOptions class in common (#89)
rlazo Mar 20, 2024
b2afc55
Add support for usage metadata (#91)
rlazo Mar 22, 2024
672f0a4
Add support for FileData (#92)
daymxn Mar 22, 2024
47135cf
added quota exceeded exception (#93)
davidmotson Mar 25, 2024
849f432
Depend on right mockk version (#94)
rlazo Mar 25, 2024
a2b71df
Function calling (common only) (#97)
rlazo Mar 26, 2024
ab722b6
Bump futures dependency (#98)
rlazo Mar 27, 2024
40f496e
Don't encode the model name in the outgoing request (#101)
rlazo Mar 28, 2024
f22a52f
split the auto function calling changes between common and generative…
davidmotson Apr 2, 2024
f14808f
Add constrained decoding support (#103)
emilypgoogle Apr 3, 2024
91d69a9
Make candidateTokenCount optional for cases with no candidate (#104)
davidmotson Apr 3, 2024
6bc885f
Add clientId parameter in common (#107)
rlazo Apr 3, 2024
77483c3
Use a consistent naming for apiClient (#108)
rlazo Apr 3, 2024
30050e4
Add `totalBillableCharacters` to `CountTokensResponse` (#106)
rlazo Apr 3, 2024
4179344
Support releasing multiple SDKs (#109)
daymxn Apr 4, 2024
b65c155
Add support for header provider (#110)
rlazo Apr 4, 2024
1fddbab
Fix API job for new locations of api (#113)
davidmotson Apr 5, 2024
69b5610
add SystemInstruction as a param to GenerativeModel and wire it throu…
davidmotson Apr 9, 2024
753cb33
keep GenerativeModel's original parameter positions (#115)
thatfiredev Apr 9, 2024
56cf778
Bump release versions (#117)
rlazo Apr 10, 2024
287e9bb
update sample app to use v0.3.0 (#118)
thatfiredev Apr 11, 2024
2d9f5db
Make license optional and default start index to 0 for citations (#120)
rlazo Apr 18, 2024
9476b4f
Make v1beta the default api version (#123)
rlazo Apr 19, 2024
c8a0a37
Add support for FileDataPart in the request (#121)
rlazo Apr 19, 2024
910252b
Add support for SafetyRating.HarmSeverity in common (#122)
rlazo Apr 19, 2024
3f253ab
Bump generative ai sdk to 0.4.0 (#124)
rlazo Apr 19, 2024
28877bc
Update README.md (#125)
rlazo Apr 24, 2024
dd2bcaf
Fix release plugin (#126)
daymxn Apr 24, 2024
a081fb3
Remove usages of Beta flag (#127)
daymxn Apr 25, 2024
146c4d6
Correctly handle UsageMetadata (#135)
rlazo May 3, 2024
1d12b81
Bump release to 0.5.0 (genai) 0.4.0 (common) (#136)
rlazo May 3, 2024
d9531c4
Sync with v0.5.0
PatilShreyas May 4, 2024
7a929cf
Sync with v0.5.0
PatilShreyas May 4, 2024
f2253d1
Enable release signing
PatilShreyas May 4, 2024
a501df9
Merge branch 'v0.5.0-kmp' of github.com:PatilShreyas/generative-ai-km…
PatilShreyas May 4, 2024
a37282e
Merge branch 'v0.5.0-kmp-syncmain' into v0.5.0-kmp
PatilShreyas May 4, 2024
36d3403
Update release workflow
PatilShreyas May 4, 2024
a7a0e85
Update version in README.md
PatilShreyas May 4, 2024
8d5aaaa
Add a method in Content for directly appending image
PatilShreyas May 4, 2024
bf83e6e
Reformat with spotless
PatilShreyas May 4, 2024
1e0d35d
Add mockk dependency back
PatilShreyas May 4, 2024
b1c3a86
Merge branch 'wasm' of github.com:PatilShreyas/generative-ai-kmp into…
PatilShreyas May 4, 2024
43c364e
Setup Wasm variant for common
PatilShreyas May 4, 2024
d51c899
Update version
PatilShreyas May 4, 2024
d6964a9
Delete conflicted Log.kt
PatilShreyas May 4, 2024
c197baf
Update timeout with Long.MAX_VALUE
PatilShreyas May 4, 2024
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
1 change: 1 addition & 0 deletions .changes/generativeai/cork-dock-apple-cobweb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"PATCH","changes":["Remove usages of v1beta opt-in flag"]}
7 changes: 1 addition & 6 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ jobs:
- name: Publish Library
run: |
echo "Publishing library🚀"
./gradlew :generativeai:publish --no-configuration-cache
echo "Published Library✅"
echo "Releasing library...🚀"
./gradlew :generativeai:closeAndReleaseRepository --no-configuration-cache
echo "Released Library✅"
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ generate text from text-and-image input:

```kotlin
val generativeModel = GenerativeModel(
modelName = "gemini-1.0-pro-vision-latest",
modelName = "gemini-1.5-pro-vision-latest",
apiKey = "YOUR_API_KEY"
)

Expand All @@ -33,7 +33,7 @@ Supports the following Kotlin Multiplatform targets:
- [x] iOS
- [x] JVM
- [x] JS
- [x] Wasm (_Use this [version](https://github.com/PatilShreyas/generative-ai-kmp/releases/tag/v0.2.0-1.0.0-wasm)_)
- [x] Wasm (_Use this [version](https://github.com/PatilShreyas/generative-ai-kmp/releases/tag/v0.5.0-1.0.0-wasm)_)

## Installation and usage

Expand All @@ -59,7 +59,7 @@ The versioning scheme is of the form `X-Y` where:

X is the _Generative AI Android SDK_ version that is being tracked.
Y is the _Multiplatform SDK_ version.
For example, if _Generative AI Android SDK_ is on `0.2.2` and _Multiplatform SDK_ is on `1.0.0`, the artifact for a release will be `dev.shreyaspatil.generativeai:generativeai-google:0.2.2-1.0.0`.
For example, if _Generative AI Android SDK_ is on `0.5.0` and _Multiplatform SDK_ is on `1.0.0`, the artifact for a release will be `dev.shreyaspatil.generativeai:generativeai-google:0.5.0-1.0.0`.

## Try sample app

Expand Down
319 changes: 0 additions & 319 deletions api/0.2.2.api

This file was deleted.

1 change: 1 addition & 0 deletions common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
129 changes: 129 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

/*
* Copyright 2024 Shreyas Patil
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
kotlin("plugin.serialization")
alias(libs.plugins.mavenPublish)
}

kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "17"
}
}
}
jvm()
js(IR) {
browser()
nodejs()
}

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "common"
isStatic = true
}
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
moduleName = "generativeAIGoogleCommon"
browser {
commonWebpackConfig {
outputFileName = "dev.shreyaspatil.generativeai-google-common.js"
}
}

binaries.executable()
}

sourceSets {
commonMain.dependencies {
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.client.serialization.json)
implementation(libs.ktor.client.logging)

implementation(libs.kotlinx.serialization.json)

implementation(libs.kotlinx.coroutines.core)
}
androidMain.dependencies {
api(libs.ktor.client.okhttp)
}
jvmMain.dependencies {
api(libs.ktor.client.okhttp)
api(libs.slf4j.api)
}
iosMain.dependencies {
api(libs.ktor.client.darwin)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
implementation(libs.kotest.assertions.core)
implementation(libs.kotest.assertions.json)
implementation(libs.ktor.client.mock)
}
}
}

android {
namespace = "dev.shreyaspatil.ai.client.generativeai.common"
compileSdk = 34

buildFeatures.buildConfig = true

defaultConfig {
minSdk = 21

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

testOptions {
unitTests.isReturnDefaultValues = true
}
}
21 changes: 21 additions & 0 deletions common/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 2 additions & 0 deletions common/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
POM_ARTIFACT_ID=common
POM_NAME=Google Generative AI - Common
21 changes: 21 additions & 0 deletions common/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.shreyaspatil.ai.client.generativeai.platform
package dev.shreyaspatil.ai.client.generativeai.common.util

actual object Log {
actual fun d(tag: String, message: String) {
android.util.Log.d(tag, message)
}

actual fun w(tag: String, message: String) {
android.util.Log.w(tag, message)
}

actual fun e(tag: String, message: String) {
android.util.Log.e(tag, message)
actual fun e(tag: String, message: String, throwable: Throwable?) {
android.util.Log.e(tag, message, throwable)
}
}
Loading
Loading