-;i+>ddlmZddlZddlmZmZddlmcmZddl m Z ddl m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZddd dIdZddd dJdZddd dKdZ dLdMdZdddd dNd$Zdddd dOd&Zdddddddddd'd(ddd) dPd<Zej dLddd dQdAZ ejddd dRdCZ dLddd dSdFZ dGZ! dTdUdHZ"dS)V) annotationsN)AnyLiteral)protos) operations)get_default_model_client) model_types) helper_types) operation)protobuf_helpers)field_mask_pb2)flatten_update_pathsclientrequest_optionsnamemodel_types.AnyModelNameOptionsr&helper_types.RequestOptionsType | Nonereturn*model_types.Model | model_types.TunedModelctj|}|drt|||S|drt |||St d|)aoCalls the API to fetch a model by name. ``` import pprint model = genai.get_model('models/gemini-1.5-flash') pprint.pprint(model) ``` Args: name: The name of the model to fetch. Should start with `models/` client: The client to use. request_options: Options for the request. Returns: A `types.Model` models/r tunedModels/zWInvalid model name: Model names must start with `models/` or `tunedModels/`. Received: )r make_model_name startswithget_base_modelget_tuned_model ValueError)rrrs NC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\google/generativeai/models.py get_modelr !s,  &t , ,D y!! d6?SSSS  ( ( tFOTTTT lfj l l   model_types.BaseModelNameOptionsmodel_types.Modelc$|i}|t}tj|}|dst d||jdd|i|}t ||}tjdi|S)axCalls the API to fetch a base model by name. ``` import pprint model = genai.get_base_model('models/chat-bison-001') pprint.pprint(model) ``` Args: name: The name of the model to fetch. Should start with `models/` client: The client to use. request_options: Options for the request. Returns: A `types.Model`. NrzJInvalid model name: Base model names must start with `models/`. Received: r) rr rrrr typeto_dictModelrrrresults rrrBs, ~)++  &t , ,D ??9 % %  _Y] _ _   V  ; ;4 ;? ; ;F &\\ ! !& ) )F   & &v & &&r!!model_types.TunedModelNameOptionsmodel_types.TunedModelc|i}|t}tj|}|dst d||jdd|i|}tj|S)aCalls the API to fetch a tuned model by name. ``` import pprint model = genai.get_tuned_model('tunedModels/gemini-1.5-flash') pprint.pprint(model) ``` Args: name: The name of the model to fetch. Should start with `tunedModels/` client: The client to use. request_options: Options for the request. Returns: A `types.TunedModel`. NrzPInvalid model name: Tuned model names must start with `tunedModels/`. Received: rr%)rr rrrrdecode_tuned_modelr)s rrris, ~)++  &t , ,D ??> * *  e_c e e   $V # A A A A AF  )& 1 11r!modelrglm.ModelServiceClient | Nonect|tr1|drt||}|j}n|}nt|t jr|j}nt|t jr|j}not|tjr|j}nMt|tjr t|dd}|s |j j}ntd|d|S)z6Calls the API to fetch the base model name of a model.r)r base_modelNz#Invalid model: The provided model 'z' is not recognized or supported. Supported types are: str, model_types.TunedModel, model_types.Model, protos.Model, and protos.TunedModel.) isinstancestrrr r2r TunedModelr(rrgetattrtuned_model_source TypeError)r/rr2s rget_base_model_namer9s %   N + + eF333E)JJJJ E;1 2 2 % E;, - -  Z E6< ( (  Z E6, - - UL$77  =1rs#""""" *********&&&&&&******??????111111222222%%%%%%,,,,,,******:::::: >B       H >B $'$'$'$'$'$'T >B %2%2%2%2%2%2RUY@,0>B ))))))H,0>B !4!4!4!4!4!4P#" $"!"&!,0>B!{O{O{O{O{O{O| -1>B        -1>B       &*22-1>B 222222222222j%%%-1>B<<<<<<