machine-learning-api-client.d.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*! firebase-admin v12.1.1 */
  2. /*!
  3. * Copyright 2020 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /**
  18. * Firebase ML Model input objects
  19. */
  20. export interface ModelOptionsBase {
  21. displayName?: string;
  22. tags?: string[];
  23. }
  24. export interface GcsTfliteModelOptions extends ModelOptionsBase {
  25. tfliteModel: {
  26. gcsTfliteUri: string;
  27. };
  28. }
  29. export type ModelOptions = ModelOptionsBase | GcsTfliteModelOptions;
  30. /**
  31. * Interface representing options for listing Models.
  32. */
  33. export interface ListModelsOptions {
  34. /**
  35. * An expression that specifies how to filter the results.
  36. *
  37. * Examples:
  38. *
  39. * ```
  40. * display_name = your_model
  41. * display_name : experimental_*
  42. * tags: face_detector AND tags: experimental
  43. * state.published = true
  44. * ```
  45. *
  46. * See https://firebase.google.com/docs/ml/manage-hosted-models#list_your_projects_models
  47. */
  48. filter?: string;
  49. /** The number of results to return in each page. */
  50. pageSize?: number;
  51. /** A token that specifies the result page to return. */
  52. pageToken?: string;
  53. }
  54. export interface StatusErrorResponse {
  55. readonly code: number;
  56. readonly message: string;
  57. }
  58. export type ModelUpdateOptions = ModelOptions & {
  59. state?: {
  60. published?: boolean;
  61. };
  62. };
  63. export declare function isGcsTfliteModelOptions(options: ModelOptions): options is GcsTfliteModelOptions;
  64. export interface ModelContent {
  65. readonly displayName?: string;
  66. readonly tags?: string[];
  67. readonly state?: {
  68. readonly validationError?: StatusErrorResponse;
  69. readonly published?: boolean;
  70. };
  71. readonly tfliteModel?: {
  72. readonly gcsTfliteUri?: string;
  73. readonly sizeBytes: number;
  74. };
  75. }
  76. export interface ModelResponse extends ModelContent {
  77. readonly name: string;
  78. readonly createTime: string;
  79. readonly updateTime: string;
  80. readonly etag: string;
  81. readonly modelHash?: string;
  82. readonly activeOperations?: OperationResponse[];
  83. }
  84. export interface ListModelsResponse {
  85. readonly models?: ModelResponse[];
  86. readonly nextPageToken?: string;
  87. }
  88. export interface OperationResponse {
  89. readonly name?: string;
  90. readonly metadata?: {
  91. [key: string]: any;
  92. };
  93. readonly done: boolean;
  94. readonly error?: StatusErrorResponse;
  95. readonly response?: ModelResponse;
  96. }