google_client#
Google GenAI ModelClient integration.
Classes
|
A component wrapper for the Google GenAI API client. |
- class GoogleGenAIClient(api_key: str | None = None)[source]#
Bases:
ModelClient
A component wrapper for the Google GenAI API client.
Visit https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference for more api details.
Info: 8/1/2024 Tested: gemini-1.0-pro, gemini-1.5-pro-latest class UsageMetadata(proto.Message):
- prompt_token_count: int = proto.Field(
proto.INT32, number=1,
) cached_content_token_count: int = proto.Field(
proto.INT32, number=4,
) candidates_token_count: int = proto.Field(
proto.INT32, number=2,
) total_token_count: int = proto.Field(
proto.INT32, number=3,
)
- parse_chat_completion(completion: GenerateContentResponse) GeneratorOutput [source]#
Parse the completion to a structure your sytem standarizes. (here is str)
- track_completion_usage(completion: GenerateContentResponse) CompletionUsage [source]#
Track the chat completion usage. Use OpenAI standard API for tracking.
- convert_inputs_to_api_kwargs(input: Any | None = None, model_kwargs: Dict = {}, model_type: ModelType = ModelType.UNDEFINED) Dict [source]#
Specify the API input type and output api_kwargs that will be used in _call and _acall methods. Convert the Component’s standard input, and system_input(chat model) and model_kwargs into API-specific format