Skip to content

Commit dbdd135

Browse files
cynthiajoannateboschMichaelVerdonSelaseKayLyokone
authored
feat(firebaseai): Developer API (#17342)
* feat(vertexai): Allow serializing to Developer API models (#17294) Move parsing from top level methods, and serialization from a method on the model,into instance methods on a new `SerializationStrategy` class. Use the existing parsing code for the vertex strategy and copy over code form the developer SDK for the Google AI strategy. Add a `_ModelUri` class to allow a vertex and developer specialization for the different backends. Copy the serialization and parsing tests from the developer SDK, skip a few tests that rely on arguments or methods that are unsupported in the vertex model. Tests skipped for content embedding and extra arguments passed to countTokens. * chore(vertexai): update sample for developer api and fix the instance key for FirebaseVertexAI (#17319) * add imagen developer api support (#17321) * feat(vertexai): Add a new package firebase_ai (#17332) * Add a new package firebase_ai Copy all the code from firebase_vertexai and rename with "Vertex" removed or replaced with "Firebase". Make firebase_vertexai an export package, retaining only the FirebaseVertexAI implementation and adding `typedef` aliases for 2 renamed exception types. Replace the rest with exports from `package:firebase_ai`. Revert the examples changes to use googleAI - the example in the `firebase_ai` package will show both while the old example shows only the usage of vertex.. Import from src across the packages to keep existing tests as close to identical as possible despite doubling up test cases with the upstream package. * Move to new directory * Add ::vertexai and ::googlai instance key suffixes * Use ovrride and new SpeaechConfig API * Remove export of TaskType * Remove duplicate testing of the base model * Use 2.0.0 as initial version * Reformat * Add a failing test - check if CI is already running * Remove failing test CI is confirmed running for this package. * Add a copy of the analysis options in the new parent directory * Revert to latest version of example app Minor code changes for the interface change. * Restore the same example app in both packages Minor code changes in the _vertexai example app for the interface differences --------- Co-authored-by: Cynthia J <[email protected]> * add all_link_rules.yaml to the root of new package * chore(firebaseai): merge main into developer api branch (#17341) * chore(ci): bump macos-14 to macos-15 (#17311) * feat(cloud_functions): add support for cloud functions stream (#17214) * chore: add platform interface and method channel implementation for Cloud Functions stream * chore: add `httpsCallableStreamFromUrl` and `httpsStreamCallableWithUri` * chore: resolve comments * chore: add Android implementation for Cloud Functions stream * chore: resolve formatting issues * chore: correct variable name * chore: add support for Cloud Functions Stream(Android) * chore: create dedicated StreamHandler class * chore: add streamhandler implementation for ios * chore: add iOS implementation for Cloud Functions stream * chore: add license header to stream handler files * chore: web Cloud Functions stream wip * chore: push all * chore: update functions based on API Doc modification * chore: clean up code * chore: add web package * chore: add streaming example * chore: fix ci issues * chore: fix ci * chore: fix cloud function test * chore: add missing doc * chore: fixes and clean up * chore: add e2e for Cloud Functions Stream * chore: fix formatting issue * chore: add more tests and fix timeout for Android * chore: add test for map and list * chore: fix test * chore: update year to 2025 in files * chore(web): add support for abort signal * chore: resolve comments and add test for Abort * chore: fix test * chore: fix test * chore: update copyright year * chore: print error to console * chore(release): publish packages (#17314) * chore(release): publish packages - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected]+1 * chore: BoM Version 3.10.0 * constants * fix(auth,apple): prevent EXC_BAD_ACCESS crash in Apple Sign-In completion handler (#17273) - Locally captures completion handler to prevent deallocation - Fixes crash during async Apple Sign-In operations * chore(docs): Update Extension Helper Docs (#17327) * feat(vertexai): Add HarmBlockThreshold.OFF (#17325) * Add HarmBlockThreshold.OFF. Add unit test for api. Fix the schema output json. * fix a nit * feat(fdc): Included platform detection changes (#17308) * feat(vertexai): Add responseModality (#17326) * Add responseModality * review comments * handle omit tokenCount nicely (#17336) * Add new attributes for schema (#17340) * tweak after merge main * fix analyzer for vertexai/api_test.dart * remove dependency_overrides in pubspec.yaml --------- Co-authored-by: MichaelV00 <[email protected]> Co-authored-by: Jude Selase Kwashie <[email protected]> Co-authored-by: Guillaume Bernos <[email protected]> Co-authored-by: Luke Memet <[email protected]> Co-authored-by: Maneesh Tewani <[email protected]> * manually update the schema_test with main code * add the deprecation document (#17344) * ignore deprecated_member_use for example in firebase_vertexai * fix bidi web socket channel connect for chrome * review comments * readme words update * try ignore the deprecation in the whole package analysis_options --------- Co-authored-by: Nate Bosch <[email protected]> Co-authored-by: MichaelV00 <[email protected]> Co-authored-by: Jude Selase Kwashie <[email protected]> Co-authored-by: Guillaume Bernos <[email protected]> Co-authored-by: Luke Memet <[email protected]> Co-authored-by: Maneesh Tewani <[email protected]>
1 parent 0eb17e1 commit dbdd135

File tree

181 files changed

+13996
-490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+13996
-490
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Copyright 2021 The Chromium Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# in the LICENSE file.
4+
5+
linter:
6+
rules:
7+
- always_declare_return_types
8+
- always_put_control_body_on_new_line
9+
- always_put_required_named_parameters_first
10+
- always_require_non_null_named_parameters
11+
- always_specify_types
12+
- always_use_package_imports
13+
- annotate_overrides
14+
- avoid_annotating_with_dynamic
15+
- avoid_bool_literals_in_conditional_expressions
16+
- avoid_catches_without_on_clauses
17+
- avoid_catching_errors
18+
- avoid_classes_with_only_static_members
19+
- avoid_double_and_int_checks
20+
- avoid_empty_else
21+
- avoid_equals_and_hash_code_on_mutable_classes
22+
- avoid_escaping_inner_quotes
23+
- avoid_field_initializers_in_const_classes
24+
- avoid_function_literals_in_foreach_calls
25+
- avoid_implementing_value_types
26+
- avoid_init_to_null
27+
- avoid_js_rounded_ints
28+
- avoid_null_checks_in_equality_operators
29+
- avoid_positional_boolean_parameters
30+
- avoid_print
31+
- avoid_private_typedef_functions
32+
- avoid_redundant_argument_values
33+
- avoid_relative_lib_imports
34+
- avoid_renaming_method_parameters
35+
- avoid_return_types_on_setters
36+
- avoid_returning_null
37+
- avoid_returning_null_for_future
38+
- avoid_returning_null_for_void
39+
- avoid_returning_this
40+
- avoid_setters_without_getters
41+
- avoid_shadowing_type_parameters
42+
- avoid_single_cascade_in_expression_statements
43+
- avoid_slow_async_io
44+
- avoid_type_to_string
45+
- avoid_types_as_parameter_names
46+
- avoid_types_on_closure_parameters
47+
- avoid_unnecessary_containers
48+
- avoid_unused_constructor_parameters
49+
- avoid_void_async
50+
- avoid_web_libraries_in_flutter
51+
- await_only_futures
52+
- camel_case_extensions
53+
- camel_case_types
54+
- cancel_subscriptions
55+
- cascade_invocations
56+
- cast_nullable_to_non_nullable
57+
- close_sinks
58+
- comment_references
59+
- constant_identifier_names
60+
- control_flow_in_finally
61+
- curly_braces_in_flow_control_structures
62+
- diagnostic_describe_all_properties
63+
- directives_ordering
64+
- do_not_use_environment
65+
- empty_catches
66+
- empty_constructor_bodies
67+
- empty_statements
68+
- exhaustive_cases
69+
- file_names
70+
- flutter_style_todos
71+
- hash_and_equals
72+
- implementation_imports
73+
- invariant_booleans
74+
- iterable_contains_unrelated_type
75+
- join_return_with_assignment
76+
- leading_newlines_in_multiline_strings
77+
- library_names
78+
- library_prefixes
79+
- lines_longer_than_80_chars
80+
- list_remove_unrelated_type
81+
- literal_only_boolean_expressions
82+
- missing_whitespace_between_adjacent_strings
83+
- no_adjacent_strings_in_list
84+
- no_default_cases
85+
- no_duplicate_case_values
86+
- no_logic_in_create_state
87+
- no_runtimeType_toString
88+
- non_constant_identifier_names
89+
- null_check_on_nullable_type_parameter
90+
- null_closures
91+
- omit_local_variable_types
92+
- one_member_abstracts
93+
- only_throw_errors
94+
- overridden_fields
95+
- package_api_docs
96+
- package_names
97+
- package_prefixed_library_names
98+
- parameter_assignments
99+
- prefer_adjacent_string_concatenation
100+
- prefer_asserts_in_initializer_lists
101+
- prefer_asserts_with_message
102+
- prefer_collection_literals
103+
- prefer_conditional_assignment
104+
- prefer_const_constructors
105+
- prefer_const_constructors_in_immutables
106+
- prefer_const_declarations
107+
- prefer_const_literals_to_create_immutables
108+
- prefer_constructors_over_static_methods
109+
- prefer_contains
110+
- prefer_double_quotes
111+
- prefer_equal_for_default_values
112+
- prefer_expression_function_bodies
113+
- prefer_final_fields
114+
- prefer_final_in_for_each
115+
- prefer_final_locals
116+
- prefer_for_elements_to_map_fromIterable
117+
- prefer_foreach
118+
- prefer_function_declarations_over_variables
119+
- prefer_generic_function_type_aliases
120+
- prefer_if_elements_to_conditional_expressions
121+
- prefer_if_null_operators
122+
- prefer_initializing_formals
123+
- prefer_inlined_adds
124+
- prefer_int_literals
125+
- prefer_interpolation_to_compose_strings
126+
- prefer_is_empty
127+
- prefer_is_not_empty
128+
- prefer_is_not_operator
129+
- prefer_iterable_whereType
130+
- prefer_mixin
131+
- prefer_null_aware_operators
132+
- prefer_relative_imports
133+
- prefer_single_quotes
134+
- prefer_spread_collections
135+
- prefer_typing_uninitialized_variables
136+
- prefer_void_to_null
137+
- provide_deprecation_message
138+
- public_member_api_docs
139+
- recursive_getters
140+
- sized_box_for_whitespace
141+
- slash_for_doc_comments
142+
- sort_child_properties_last
143+
- sort_constructors_first
144+
- sort_pub_dependencies
145+
- sort_unnamed_constructors_first
146+
- test_types_in_equals
147+
- throw_in_finally
148+
- tighten_type_of_initializing_formals
149+
- type_annotate_public_apis
150+
- type_init_formals
151+
- unawaited_futures
152+
- unnecessary_await_in_return
153+
- unnecessary_brace_in_string_interps
154+
- unnecessary_const
155+
- unnecessary_final
156+
- unnecessary_getters_setters
157+
- unnecessary_lambdas
158+
- unnecessary_new
159+
- unnecessary_null_aware_assignments
160+
- unnecessary_null_checks
161+
- unnecessary_null_in_if_null_operators
162+
- unnecessary_nullable_for_final_variable_declarations
163+
- unnecessary_overrides
164+
- unnecessary_parenthesis
165+
- unnecessary_raw_strings
166+
- unnecessary_statements
167+
- unnecessary_string_escapes
168+
- unnecessary_string_interpolations
169+
- unnecessary_this
170+
- unrelated_type_equality_checks
171+
- unsafe_html
172+
- use_full_hex_values_for_flutter_colors
173+
- use_function_type_syntax_for_parameters
174+
- use_is_even_rather_than_modulo
175+
- use_key_in_widget_constructors
176+
- use_late_for_private_fields_and_variables
177+
- use_raw_strings
178+
- use_rethrow_when_possible
179+
- use_setters_to_change_properties
180+
- use_string_buffers
181+
- use_to_and_as_if_applicable
182+
- valid_regexps
183+
- void_checks
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Copyright 2021 The Chromium Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# in the LICENSE file.
4+
5+
include: all_lint_rules.yaml
6+
analyzer:
7+
# TODO(rrousselGit): disable implicit-cast/implicit-dynamic
8+
errors:
9+
# Otherwise cause the import of all_lint_rules to warn because of some rules conflicts.
10+
# We explicitly enabled even conflicting rules and are fixing the conflict
11+
# in this file
12+
included_file_warning: ignore
13+
14+
linter:
15+
rules:
16+
## Disabled rules because the repository doesn't respect them (yet)
17+
18+
always_put_control_body_on_new_line: false
19+
comment_references: false
20+
prefer_constructors_over_static_methods: false
21+
prefer_final_fields: false
22+
prefer_final_locals: false
23+
omit_local_variable_types: false
24+
avoid_equals_and_hash_code_on_mutable_classes: false
25+
26+
#############
27+
28+
# Personal preference. I don't find it more readable
29+
cascade_invocations: false
30+
31+
# Conflicts with `prefer_single_quotes`
32+
# Single quotes are easier to type and don't compromise on readability.
33+
prefer_double_quotes: false
34+
35+
# Conflicts with `omit_local_variable_types` and other rules.
36+
# As per Dart guidelines, we want to avoid unnecessary types to make the code
37+
# more readable.
38+
# See https://dart.dev/guides/language/effective-dart/design#avoid-type-annotating-initialized-local-variables
39+
always_specify_types: false
40+
41+
# Incompatible with `prefer_final_locals`
42+
# Having immutable local variables makes larger functions more predictible
43+
# so we will use `prefer_final_locals` instead.
44+
unnecessary_final: false
45+
46+
# Not quite suitable for Flutter, which may have a `build` method with a single
47+
# return, but that return is still complex enough that a "body" is worth it.
48+
prefer_expression_function_bodies: false
49+
50+
# Conflicts with the convention used by flutter, which puts `Key key`
51+
# and `@required Widget child` last.
52+
always_put_required_named_parameters_first: false
53+
54+
# This project doesn't use Flutter-style todos
55+
flutter_style_todos: false
56+
57+
# There are situations where we voluntarily want to catch everything,
58+
# especially as a library.
59+
avoid_catches_without_on_clauses: false
60+
61+
# Boring as it sometimes force a line of 81 characters to be split in two.
62+
# As long as we try to respect that 80 characters limit, going slightly
63+
# above is fine.
64+
lines_longer_than_80_chars: false
65+
66+
# Conflicts with disabling `implicit-dynamic`
67+
avoid_annotating_with_dynamic: false
68+
69+
# conflicts with `prefer_relative_imports`
70+
always_use_package_imports: false
71+
72+
# Disabled for now until we have NNBD as it otherwise conflicts with `missing_return`
73+
no_default_cases: false
74+
75+
# False positive, null checks don't need a message
76+
prefer_asserts_with_message: false
77+
78+
# Cumbersome with `context.select`
79+
avoid_types_on_closure_parameters: false
80+
81+
# Too many false positive (builders)
82+
diagnostic_describe_all_properties: false
83+
84+
# false positives (setter-like functions)
85+
avoid_positional_boolean_parameters: false
86+
87+
# Does not apply to providers
88+
prefer_const_constructors_in_immutables: false
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 2.0.0
2+
3+
- Initial release following package rename from `firebase_vertexai`.

0 commit comments

Comments
 (0)