gen_ai_hub.proxy.langchain.init_models
index
/home/jenkins/agent/workspace/ation_generative-ai-hub-sdk_main/gen_ai_hub/proxy/langchain/init_models.py

 
Modules
       
gen_ai_hub.proxy.langchain.amazon
gen_ai_hub.proxy.langchain.google_genai
gen_ai_hub.proxy.langchain.openai

 
Classes
       
enum.Enum(builtins.object)
ModelType

 
class ModelType(enum.Enum)
    ModelType(value, names=None, *, module=None, qualname=None, type=None, start=1)
 
An enumeration.
 
 
Method resolution order:
ModelType
enum.Enum
builtins.object

Data and other attributes defined here:
EMBEDDINGS = <ModelType.EMBEDDINGS: 2>
LLM = <ModelType.LLM: 1>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Readonly properties inherited from enum.EnumMeta:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
Functions
       
default_f_select_deployment(proxy_client: 'BaseProxyClient', **model_identification_kwargs: 'Dict[str, str]') -> 'BaseDeployment'
Default function to select a deployment based on model identification kwargs.
 
:param proxy_client: The proxy client to use for selecting the deployment
:type proxy_client: BaseProxyClient
:return: The selected deployment
:rtype: BaseDeployment
handle_model_args_kwargs(proxy_client, args: 'List[Any]', kwargs: 'Dict[str, Any]')
Handles model identification arguments and keyword arguments.
 
:param proxy_client: the proxy client to use for model identification
:type proxy_client: _type_
:param args: list of positional arguments
:type args: List[Any]
:param kwargs: dictionary of keyword arguments
:type kwargs: Dict[str, Any]
:raises ValueError: if no model identification argument is provided
:return: A tuple containing the model name, model identification kwargs, and remaining kwargs
:rtype: Tuple[str, Dict[str, str], Dict[str, Any]]
init_embedding_model(*args, proxy_client: 'Optional[BaseProxyClient]' = None, init_func: 'Optional[Callable]' = None, model_id: 'Optional[str]' = '', **kwargs) -> 'Embeddings'
Initializes an embedding model using the specified parameters.
 
:param proxy_client: The proxy client to use for the model (optional)
:type proxy_client: BaseProxyClient
:param init_func: Function to call for initializing the model, optional
:type init_func: Callable
:param model_id: id of the Amazon Bedrock model, needed in case a custom Amazon Bedrock model is being
                 initiated (optional)
:type model_id: str
:return: The initialized embedding model
:rtype: Embeddings
init_llm(*args, proxy_client: 'Optional[BaseProxyClient]' = None, temperature: 'float' = 0.0, max_tokens: 'int' = 256, top_k: 'Optional[int]' = None, top_p: 'float' = 1.0, init_func: 'Optional[Callable]' = None, model_id: 'Optional[str]' = '', **kwargs) -> 'BaseLanguageModel'
Initializes a language model using the specified parameters.
 
:param proxy_client: The proxy client to use for the model (optional)
:type proxy_client: ProxyClient
:param temperature: The temperature parameter for model generation (default: 0.0)
:type temperature: float
:param max_tokens: The maximum number of tokens to generate (default: 256)
:type max_tokens: int
:param top_k: The top-k parameter for model generation (optional)
:type top_k: int
:param top_p: The top-p parameter for model generation (default: 1.0)
:type top_p: float
:param init_func: Function to call for initializing the model, optional
:type init_func: Callable
:param model_id: id of the Amazon Bedrock model, needed in case a custom Amazon Bedrock model is being
                 initiated (optional)
:type model_id: str
:return: The initialized language model
:rtype: BaseLanguageModel

 
Data
        Any = typing.Any
Callable = typing.Callable
Dict = typing.Dict
List = typing.List
Optional = typing.Optional
Union = typing.Union
annotations = _Feature((3, 7, 0, 'beta', 1), (3, 11, 0, 'alpha', 0), 16777216)