Skip to content

Commit b753d98

Browse files
authored
VertexAI - Change packaging logic to use a source library (#1196)
* VertexAI - Change logic to use a source library * Mark internal methods with comments * Update ModelContent.cs * Update build_testapps.json * Update comments * More comments
1 parent 66c0a62 commit b753d98

27 files changed

+337
-52
lines changed

scripts/gha/integration_testing/build_testapps.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,23 @@
214214
"com.google.firebase.auth-*.tgz",
215215
"com.google.firebase.storage-*.tgz"
216216
]
217+
},
218+
{
219+
"name": "vertexai",
220+
"full_name": "FirebaseVertexAI",
221+
"captial_name": "VertexAI",
222+
"bundle_id": "com.google.firebase.unity.vertexai.testapp",
223+
"testapp_path": "vertexai/testapp",
224+
"platforms": ["Android", "Playmode", "iOS", "tvOS", "Windows", "macOS", "Linux"],
225+
"plugins": [
226+
"FirebaseVertexAI.unitypackage"
227+
],
228+
"provision": "Firebase_Dev_Wildcard.mobileprovision",
229+
"upm_packages": [
230+
"com.google.external-dependency-manager-*.tgz",
231+
"com.google.firebase.app-*.tgz",
232+
"com.google.firebase.vertexai-*.tgz"
233+
]
217234
}
218235
],
219236
"skipped_testapp_files": [

unity_packer/debug_single_export_json/vertexai.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,9 @@
215215
"name": "FirebaseVertexAI.unitypackage",
216216
"imports": [
217217
{
218-
"importer": "PluginImporter",
219-
"platforms": [
220-
"Editor",
221-
"Standalone",
222-
"Android",
223-
"iOS",
224-
"tvOS"
225-
],
226-
"cpu": "AnyCPU",
218+
"importer": "DefaultImporter",
227219
"paths": [
228-
"Firebase/Plugins/Firebase.VertexAI.dll",
229-
"Firebase/Plugins/Firebase.VertexAI.pdb"
220+
"Firebase/VertexAI/*"
230221
]
231222
},
232223
{

vertexai/CMakeLists.txt

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,19 @@
1414

1515
# CMake file for the Vertex AI in Firebase library
1616

17-
# Vertex AI in Firebase CSharp files
18-
set(firebase_vertexai_src
19-
src/Candidate.cs
20-
src/Chat.cs
21-
src/Citation.cs
22-
src/CountTokensResponse.cs
23-
src/FunctionCalling.cs
24-
src/GenerateContentResponse.cs
25-
src/GenerationConfig.cs
26-
src/GenerativeModel.cs
27-
src/ModelContent.cs
28-
src/RequestOptions.cs
29-
src/Safety.cs
30-
src/Schema.cs
31-
src/VertexAI.cs
32-
src/VertexAIException.cs
17+
# Vertex AI in Firebase is different from the other Firebase libraries,
18+
# as instead of prebuilding, we provide it as a source library.
19+
20+
# Package every file under src, including subfolders, since we want them all.
21+
unity_pack_folder(
22+
"${FIREBASE_UNITY_DIR}/vertexai/src/"
23+
PACK_PATH "Firebase/VertexAI"
3324
)
3425

26+
# For documentation, get only the C# files at the top level,
27+
# which make up the public API.
28+
file(GLOB firebase_vertexai_doc_src "src/*.cs")
3529
unity_pack_documentation_sources(vertexai
3630
DOCUMENTATION_SOURCES
3731
${firebase_vertexai_src}
3832
)
39-
40-
mono_add_library(firebase_vertexai
41-
MODULE
42-
Firebase.VertexAI
43-
SOURCES
44-
${firebase_vertexai_src}
45-
REFERENCES
46-
${FIREBASE_PLATFORM_REF}
47-
)
48-
49-
unity_pack_cs(firebase_vertexai)
50-
51-
set_property(TARGET firebase_vertexai
52-
PROPERTY FOLDER
53-
"Firebase ${FIREBASE_PLATFORM_NAME}"
54-
)

vertexai/src/Candidate.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ private static FinishReason ParseFinishReason(string str) {
121121
};
122122
}
123123

124+
/// <summary>
125+
/// Intended for internal use only.
126+
/// This method is used for deserializing JSON responses and should not be called directly.
127+
/// </summary>
124128
internal static Candidate FromJson(Dictionary<string, object> jsonDict) {
125129
return new Candidate(
126130
jsonDict.ParseObject("content", ModelContent.FromJson, defaultValue: new ModelContent("model")),

vertexai/src/Candidate.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertexai/src/Chat.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertexai/src/Citation.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ private CitationMetadata(List<Citation> citations) {
3838
_citations = new ReadOnlyCollection<Citation>(citations ?? new List<Citation>());
3939
}
4040

41+
/// <summary>
42+
/// Intended for internal use only.
43+
/// This method is used for deserializing JSON responses and should not be called directly.
44+
/// </summary>
4145
internal static CitationMetadata FromJson(Dictionary<string, object> jsonDict) {
4246
return new CitationMetadata(
4347
jsonDict.ParseObjectList("citations", Citation.FromJson));
@@ -84,6 +88,10 @@ private Citation(int startIndex, int endIndex, Uri uri, string title,
8488
PublicationDate = publicationDate;
8589
}
8690

91+
/// <summary>
92+
/// Intended for internal use only.
93+
/// This method is used for deserializing JSON responses and should not be called directly.
94+
/// </summary>
8795
internal static Citation FromJson(Dictionary<string, object> jsonDict) {
8896
// If there is a Uri, need to convert it.
8997
Uri uri = null;

vertexai/src/Citation.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertexai/src/CountTokensResponse.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertexai/src/FunctionCalling.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)