Skip to content

wire through response schema from common #6114

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

Merged
merged 3 commits into from
Jul 23, 2024
Merged

Conversation

davidmotson
Copy link
Collaborator

No description provided.

@davidmotson davidmotson requested a review from rlazo July 19, 2024 18:20
Copy link
Contributor

github-actions bot commented Jul 19, 2024

Javadoc Changes:
--- /home/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/vertexai/type/GenerationConfig.Builder.html	2024-07-19 18:33:53.481358121 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/vertexai/type/GenerationConfig.Builder.html	2024-07-19 18:31:49.965009947 +0000
@@ -66,6 +66,12 @@
             </td>
           </tr>
           <tr>
+            <td><code>final <a href="/docs/reference/android/com/google/firebase/vertexai/type/Schema.html">Schema</a>&lt;@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> ?&gt;</code></td>
+            <td>
+              <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#responseSchema()">responseSchema</a></code></div>
+            </td>
+          </tr>
+          <tr>
             <td><code>final <a href="https://developer.android.com/reference/kotlin/java/util/List.html">List</a>&lt;@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a>&gt;</code></td>
             <td>
               <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#stopSequences()">stopSequences</a></code></div>
@@ -154,6 +160,10 @@
         <h3 class="api-name" id="responseMimeType()">responseMimeType</h3>
         <pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a>&nbsp;<a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#responseMimeType()">responseMimeType</a></pre>
       </div>
+      <div class="api-item"><a name="getResponseSchema()"></a><a name="setResponseSchema()"></a><a name="getResponseSchema--"></a><a name="setResponseSchema--"></a>
+        <h3 class="api-name" id="responseSchema()">responseSchema</h3>
+        <pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="/docs/reference/android/com/google/firebase/vertexai/type/Schema.html">Schema</a>&lt;@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> ?&gt;&nbsp;<a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#responseSchema()">responseSchema</a></pre>
+      </div>
       <div class="api-item"><a name="getStopSequences()"></a><a name="setStopSequences()"></a><a name="getStopSequences--"></a><a name="setStopSequences--"></a>
         <h3 class="api-name" id="stopSequences()">stopSequences</h3>
         <pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="https://developer.android.com/reference/kotlin/java/util/List.html">List</a>&lt;@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a>&gt;&nbsp;<a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#stopSequences()">stopSequences</a></pre>
--- /home/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/vertexai/type/GenerationConfig.html	2024-07-19 18:33:53.481358121 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/vertexai/type/GenerationConfig.html	2024-07-19 18:31:49.969009962 +0000
@@ -69,6 +69,14 @@
             <td><code>final <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a></code></td>
             <td>
               <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.html#responseMimeType()">responseMimeType</a></code></div>
+              <p>Response type for generated candidate text.</p>
+            </td>
+          </tr>
+          <tr>
+            <td><code>final <a href="/docs/reference/android/com/google/firebase/vertexai/type/Schema.html">Schema</a>&lt;@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> ?&gt;</code></td>
+            <td>
+              <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.html#responseSchema()">responseSchema</a></code></div>
+              <p>A schema that the response must adhere to, used with the <code>application/json</code> mimeType.</p>
             </td>
           </tr>
           <tr>
@@ -117,16 +125,17 @@
       <div class="api-item"><a name="getResponseMimeType()"></a><a name="setResponseMimeType()"></a><a name="getResponseMimeType--"></a><a name="setResponseMimeType--"></a>
         <h3 class="api-name" id="responseMimeType()">responseMimeType</h3>
         <pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a>&nbsp;<a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.html#responseMimeType()">responseMimeType</a></pre>
+        <p>Response type for generated candidate text. See the <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/GenerationConfig">vertex docs</a> for a list of supported types.</p>
+      </div>
+      <div class="api-item"><a name="getResponseSchema()"></a><a name="setResponseSchema()"></a><a name="getResponseSchema--"></a><a name="setResponseSchema--"></a>
+        <h3 class="api-name" id="responseSchema()">responseSchema</h3>
+        <pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="/docs/reference/android/com/google/firebase/vertexai/type/Schema.html">Schema</a>&lt;@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> ?&gt;&nbsp;<a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.html#responseSchema()">responseSchema</a></pre>
+        <p>A schema that the response must adhere to, used with the <code>application/json</code> mimeType.</p>
       </div>
       <div class="api-item"><a name="getStopSequences()"></a><a name="setStopSequences()"></a><a name="getStopSequences--"></a><a name="setStopSequences--"></a>
         <h3 class="api-name" id="stopSequences()">stopSequences</h3>
         <pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="https://developer.android.com/reference/kotlin/java/util/List.html">List</a>&lt;@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a>&gt;&nbsp;<a href="/docs/reference/android/com/google/firebase/vertexai/type/GenerationConfig.html#stopSequences()">stopSequences</a></pre>
         <p>A list of strings to stop generation on occurrence of</p>
-        <ul>
-          <li>
-            <p>@property responseMimeType Response type for generated candidate text. See the <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/GenerationConfig">vertex docs</a> for a list of supported types.</p>
-          </li>
-        </ul>
       </div>
       <div class="api-item"><a name="getTemperature()"></a><a name="setTemperature()"></a><a name="getTemperature--"></a><a name="setTemperature--"></a>
         <h3 class="api-name" id="temperature()">temperature</h3>
--- /home/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/GenerationConfig.Builder.html	2024-07-19 18:33:53.473358099 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/GenerationConfig.Builder.html	2024-07-19 18:31:49.953009902 +0000
@@ -108,6 +108,12 @@
             </td>
           </tr>
           <tr>
+            <td><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/Schema.html">Schema</a>&lt;*&gt;?</code></td>
+            <td>
+              <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#responseSchema()">responseSchema</a></code></div>
+            </td>
+          </tr>
+          <tr>
             <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html">List</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>&gt;?</code></td>
             <td>
               <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#stopSequences()">stopSequences</a></code></div>
@@ -169,6 +175,10 @@
         <h3 class="api-name" id="responseMimeType()">responseMimeType</h3>
         <pre class="api-signature no-pretty-print">var&nbsp;<a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#responseMimeType()">responseMimeType</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>?</pre>
       </div>
+      <div class="api-item"><a name="getResponseSchema()"></a><a name="setResponseSchema()"></a><a name="getResponseSchema--"></a><a name="setResponseSchema--"></a>
+        <h3 class="api-name" id="responseSchema()">responseSchema</h3>
+        <pre class="api-signature no-pretty-print">var&nbsp;<a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#responseSchema()">responseSchema</a>:&nbsp;<a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/Schema.html">Schema</a>&lt;*&gt;?</pre>
+      </div>
       <div class="api-item"><a name="getStopSequences()"></a><a name="setStopSequences()"></a><a name="getStopSequences--"></a><a name="setStopSequences--"></a>
         <h3 class="api-name" id="stopSequences()">stopSequences</h3>
         <pre class="api-signature no-pretty-print">var&nbsp;<a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.Builder.html#stopSequences()">stopSequences</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html">List</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>&gt;?</pre>
--- /home/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/GenerationConfig.html	2024-07-19 18:33:53.477358110 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/GenerationConfig.html	2024-07-19 18:31:49.957009918 +0000
@@ -86,6 +86,14 @@
             <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>?</code></td>
             <td>
               <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.html#responseMimeType()">responseMimeType</a></code></div>
+              <p>Response type for generated candidate text.</p>
+            </td>
+          </tr>
+          <tr>
+            <td><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/Schema.html">Schema</a>&lt;*&gt;?</code></td>
+            <td>
+              <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.html#responseSchema()">responseSchema</a></code></div>
+              <p>A schema that the response must adhere to, used with the <code>application/json</code> mimeType.</p>
             </td>
           </tr>
           <tr>
@@ -143,16 +151,17 @@
       <div class="api-item"><a name="getResponseMimeType()"></a><a name="setResponseMimeType()"></a><a name="getResponseMimeType--"></a><a name="setResponseMimeType--"></a>
         <h3 class="api-name" id="responseMimeType()">responseMimeType</h3>
         <pre class="api-signature no-pretty-print">val&nbsp;<a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.html#responseMimeType()">responseMimeType</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>?</pre>
+        <p>Response type for generated candidate text. See the <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/GenerationConfig">vertex docs</a> for a list of supported types.</p>
+      </div>
+      <div class="api-item"><a name="getResponseSchema()"></a><a name="setResponseSchema()"></a><a name="getResponseSchema--"></a><a name="setResponseSchema--"></a>
+        <h3 class="api-name" id="responseSchema()">responseSchema</h3>
+        <pre class="api-signature no-pretty-print">val&nbsp;<a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.html#responseSchema()">responseSchema</a>:&nbsp;<a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/Schema.html">Schema</a>&lt;*&gt;?</pre>
+        <p>A schema that the response must adhere to, used with the <code>application/json</code> mimeType.</p>
       </div>
       <div class="api-item"><a name="getStopSequences()"></a><a name="setStopSequences()"></a><a name="getStopSequences--"></a><a name="setStopSequences--"></a>
         <h3 class="api-name" id="stopSequences()">stopSequences</h3>
         <pre class="api-signature no-pretty-print">val&nbsp;<a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/GenerationConfig.html#stopSequences()">stopSequences</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html">List</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>&gt;?</pre>
         <p>A list of strings to stop generation on occurrence of</p>
-        <ul>
-          <li>
-            <p>@property responseMimeType Response type for generated candidate text. See the <a href="https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/GenerationConfig">vertex docs</a> for a list of supported types.</p>
-          </li>
-        </ul>
       </div>
       <div class="api-item"><a name="getTemperature()"></a><a name="setTemperature()"></a><a name="getTemperature--"></a><a name="setTemperature--"></a>
         <h3 class="api-name" id="temperature()">temperature</h3>

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jul 19, 2024

Copy link
Contributor

Unit Test Results

    4 files   -   4      4 suites   - 4   3s ⏱️ -23s
  50 tests +28    50 ✔️ +28  0 💤 ±0  0 ±0 
100 runs  +56  100 ✔️ +56  0 💤 ±0  0 ±0 

Results for commit 051bbf3. ± Comparison against base commit 1c03d4b.

This pull request removes 22 and adds 50 tests. Note that renamed tests count towards both.
com.google.firebase.crashlytics.internal.common.CrashlyticsControllerRobolectricTest ‑ testDoCloseSession_disabledAnrs_doesNotPersistsAppExitInfo
com.google.firebase.crashlytics.internal.common.CrashlyticsControllerRobolectricTest ‑ testDoCloseSession_enabledAnrs_doesNotPersistsAppExitInfoIfItDoesntExist
com.google.firebase.crashlytics.internal.common.CrashlyticsControllerRobolectricTest ‑ testDoCloseSession_enabledAnrs_persistsAppExitInfoIfItExists
com.google.firebase.crashlytics.internal.common.DataCollectionArbiterRobolectricTest ‑ testDefaultDataCollection_usedWhenNoOverrideOrManifestSetting
com.google.firebase.crashlytics.internal.common.DataCollectionArbiterRobolectricTest ‑ testManifestMetadata_respectedWhenNoOverride
com.google.firebase.crashlytics.internal.common.DataCollectionArbiterRobolectricTest ‑ testSetCrashlyticsDataCollectionEnabled_overridesOtherSettings
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testAppExitInfoEvent_notPersistIfAnrBeforeSession
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testAppExitInfoEvent_notPersistIfAppExitInfoNotAnrButWithinSession
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testAppExitInfoEvent_persistIfAnrWithinSession
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testAppExitInfoEvent_persistIfAnrWithinSession_multipleAppExitInfo
…
com.google.firebase.vertexai.StreamingSnapshotTests ‑ citation parsed correctly
com.google.firebase.vertexai.StreamingSnapshotTests ‑ empty content
com.google.firebase.vertexai.StreamingSnapshotTests ‑ http errors
com.google.firebase.vertexai.StreamingSnapshotTests ‑ image rejected
com.google.firebase.vertexai.StreamingSnapshotTests ‑ invalid api key
com.google.firebase.vertexai.StreamingSnapshotTests ‑ invalid json
com.google.firebase.vertexai.StreamingSnapshotTests ‑ long reply
com.google.firebase.vertexai.StreamingSnapshotTests ‑ malformed content
com.google.firebase.vertexai.StreamingSnapshotTests ‑ prompt blocked for safety
com.google.firebase.vertexai.StreamingSnapshotTests ‑ quotes escaped
…

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • firebase-vertexai

    TypeBase (1c03d4b)Merge (f179e6e)Diff
    aar161 kB161 kB+357 B (+0.2%)
    apk (release)9.32 MB9.32 MB+452 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/55DrmXfizJ.html

Copy link
Collaborator

@rlazo rlazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a tests that verifies that the specified schema, in code, is generated as expected, in JSON? You'd need to capture the request and check that the JSON in it has a few key/values as expected. This will ensure that we don't introduce unintended bugs down the road at the vertex/common translation layer

For reference https://github.com/google-gemini/generative-ai-android/blob/main/common/src/test/java/com/google/ai/client/generativeai/common/APIControllerTests.kt

@davidmotson davidmotson merged commit 9a1d120 into main Jul 23, 2024
26 of 27 checks passed
@davidmotson davidmotson deleted the davidmotson.json_schema branch July 23, 2024 17:20
@firebase firebase locked and limited conversation to collaborators Aug 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants