Summary of entries of Methods for aiplatform.
vertexai.init
init(
*,
project: typing.Optional[str] = None,
location: typing.Optional[str] = None,
experiment: typing.Optional[str] = None,
experiment_description: typing.Optional[str] = None,
experiment_tensorboard: typing.Optional[
typing.Union[
str,
google.cloud.aiplatform.tensorboard.tensorboard_resource.Tensorboard,
bool,
]
] = None,
staging_bucket: typing.Optional[str] = None,
credentials: typing.Optional[google.auth.credentials.Credentials] = None,
encryption_spec_key_name: typing.Optional[str] = None,
network: typing.Optional[str] = None,
service_account: typing.Optional[str] = None,
api_endpoint: typing.Optional[str] = None,
api_key: typing.Optional[str] = None,
api_transport: typing.Optional[str] = None,
request_metadata: typing.Optional[typing.Sequence[typing.Tuple[str, str]]] = None
)
Updates common initialization parameters with provided options.
See more: vertexai.init
vertexai.preview.end_run
end_run(
state: google.cloud.aiplatform_v1.types.execution.Execution.State = State.COMPLETE,
)
Ends the the current experiment run.
See more: vertexai.preview.end_run
vertexai.preview.get_experiment_df
get_experiment_df(
experiment: typing.Optional[str] = None, *, include_time_series: bool = True
) -> pd.DataFrame
Returns a Pandas DataFrame of the parameters and metrics associated with one experiment.
See more: vertexai.preview.get_experiment_df
vertexai.preview.log_classification_metrics
log_classification_metrics(
*,
labels: typing.Optional[typing.List[str]] = None,
matrix: typing.Optional[typing.List[typing.List[int]]] = None,
fpr: typing.Optional[typing.List[float]] = None,
tpr: typing.Optional[typing.List[float]] = None,
threshold: typing.Optional[typing.List[float]] = None,
display_name: typing.Optional[str] = None
) -> (
google.cloud.aiplatform.metadata.schema.google.artifact_schema.ClassificationMetrics
)
Create an artifact for classification metrics and log to ExperimentRun.
vertexai.preview.log_metrics
log_metrics(metrics: typing.Dict[str, typing.Union[float, int, str]])
Log single or multiple Metrics with specified key and value pairs.
See more: vertexai.preview.log_metrics
vertexai.preview.log_params
log_params(params: typing.Dict[str, typing.Union[float, int, str]])
Log single or multiple parameters with specified key and value pairs.
See more: vertexai.preview.log_params
vertexai.preview.log_time_series_metrics
log_time_series_metrics(
metrics: typing.Dict[str, float],
step: typing.Optional[int] = None,
wall_time: typing.Optional[google.protobuf.timestamp_pb2.Timestamp] = None,
)
Logs time series metrics to to this Experiment Run.
See more: vertexai.preview.log_time_series_metrics
vertexai.preview.start_run
start_run(
run: str,
*,
tensorboard: typing.Optional[
typing.Union[
google.cloud.aiplatform.tensorboard.tensorboard_resource.Tensorboard, str
]
] = None,
resume=False
) -> google.cloud.aiplatform.metadata.experiment_run_resource.ExperimentRun
Start a run to current session.
See more: vertexai.preview.start_run
vertexai.preview.tuning.sft.rebase_tuned_model
rebase_tuned_model(
tuned_model_ref: str,
*,
artifact_destination: typing.Optional[str] = None,
deploy_to_same_endpoint: typing.Optional[bool] = False
)
Re-runs fine tuning on top of a new foundational model.
vertexai.preview.tuning.sft.train
train(
*,
source_model: typing.Union[str, vertexai.generative_models.GenerativeModel],
train_dataset: str,
validation_dataset: typing.Optional[str] = None,
tuned_model_display_name: typing.Optional[str] = None,
epochs: typing.Optional[int] = None,
learning_rate_multiplier: typing.Optional[float] = None,
adapter_size: typing.Optional[typing.Literal[1, 4, 8, 16]] = None,
labels: typing.Optional[typing.Dict[str, str]] = None
) -> vertexai.tuning._supervised_tuning.SupervisedTuningJob
Tunes a model using supervised training.
See more: vertexai.preview.tuning.sft.train
vertexai.evaluation.CustomMetric
CustomMetric(
name: str,
metric_function: typing.Callable[
[typing.Dict[str, typing.Any]], typing.Dict[str, typing.Any]
],
)
Initializes the evaluation metric.
See more: vertexai.evaluation.CustomMetric
vertexai.evaluation.EvalTask
EvalTask(
*,
dataset: typing.Union[pd.DataFrame, str, typing.Dict[str, typing.Any]],
metrics: typing.List[
typing.Union[
typing.Literal[
"exact_match",
"bleu",
"rouge_1",
"rouge_2",
"rouge_l",
"rouge_l_sum",
"tool_call_valid",
"tool_name_match",
"tool_parameter_key_match",
"tool_parameter_kv_match",
],
vertexai.evaluation.CustomMetric,
vertexai.evaluation.metrics._base._AutomaticMetric,
vertexai.evaluation.metrics._base._TranslationMetric,
vertexai.evaluation.metrics.pointwise_metric.PointwiseMetric,
vertexai.evaluation.metrics.pairwise_metric.PairwiseMetric,
]
],
experiment: typing.Optional[str] = None,
metric_column_mapping: typing.Optional[typing.Dict[str, str]] = None,
output_uri_prefix: typing.Optional[str] = ""
)
Initializes an EvalTask.
See more: vertexai.evaluation.EvalTask
vertexai.evaluation.EvalTask.display_runs
display_runs()
Displays experiment runs associated with this EvalTask.
vertexai.evaluation.EvalTask.evaluate
evaluate(
*,
model: typing.Optional[
typing.Union[
vertexai.generative_models.GenerativeModel, typing.Callable[[str], str]
]
] = None,
prompt_template: typing.Optional[str] = None,
experiment_run_name: typing.Optional[str] = None,
response_column_name: typing.Optional[str] = None,
baseline_model_response_column_name: typing.Optional[str] = None,
evaluation_service_qps: typing.Optional[float] = None,
retry_timeout: float = 120.0,
output_file_name: typing.Optional[str] = None
) -> vertexai.evaluation.EvalResult
Runs an evaluation for the EvalTask.
See more: vertexai.evaluation.EvalTask.evaluate
vertexai.evaluation.MetricPromptTemplateExamples.get_prompt_template
get_prompt_template(metric_name: str) -> str
Returns the prompt template for the given metric name.
See more: vertexai.evaluation.MetricPromptTemplateExamples.get_prompt_template
vertexai.evaluation.MetricPromptTemplateExamples.list_example_metric_names
list_example_metric_names() -> typing.List[str]
Returns a list of all metric prompt templates.
See more: vertexai.evaluation.MetricPromptTemplateExamples.list_example_metric_names
vertexai.evaluation.PairwiseMetric
PairwiseMetric(
*,
metric: str,
metric_prompt_template: typing.Union[
vertexai.evaluation.metrics.metric_prompt_template.PairwiseMetricPromptTemplate,
str,
],
baseline_model: typing.Optional[
typing.Union[
vertexai.generative_models.GenerativeModel, typing.Callable[[str], str]
]
] = None
)
Initializes a pairwise evaluation metric.
See more: vertexai.evaluation.PairwiseMetric
vertexai.evaluation.PairwiseMetricPromptTemplate
PairwiseMetricPromptTemplate(
*,
criteria: typing.Dict[str, str],
rating_rubric: typing.Dict[str, str],
input_variables: typing.Optional[typing.List[str]] = None,
instruction: typing.Optional[str] = None,
metric_definition: typing.Optional[str] = None,
evaluation_steps: typing.Optional[typing.Dict[str, str]] = None,
few_shot_examples: typing.Optional[typing.List[str]] = None
)
Initializes a pairwise metric prompt template.
vertexai.evaluation.PairwiseMetricPromptTemplate.__str__
__str__()
Serializes the pairwise metric prompt template to a string.
See more: vertexai.evaluation.PairwiseMetricPromptTemplate.str
vertexai.evaluation.PairwiseMetricPromptTemplate.assemble
assemble(**kwargs) -> vertexai.evaluation.prompt_template.PromptTemplate
Replaces only the provided variables in the template with specific values.
See more: vertexai.evaluation.PairwiseMetricPromptTemplate.assemble
vertexai.evaluation.PairwiseMetricPromptTemplate.get_default_pairwise_evaluation_steps
get_default_pairwise_evaluation_steps() -> typing.Dict[str, str]
Returns the default evaluation steps for the metric prompt template.
See more: vertexai.evaluation.PairwiseMetricPromptTemplate.get_default_pairwise_evaluation_steps
vertexai.evaluation.PairwiseMetricPromptTemplate.get_default_pairwise_instruction
get_default_pairwise_instruction() -> str
Returns the default instruction for the metric prompt template.
See more: vertexai.evaluation.PairwiseMetricPromptTemplate.get_default_pairwise_instruction
vertexai.evaluation.PointwiseMetric
PointwiseMetric(
*,
metric: str,
metric_prompt_template: typing.Union[
vertexai.evaluation.metrics.metric_prompt_template.PointwiseMetricPromptTemplate,
str,
]
)
Initializes a pointwise evaluation metric.
See more: vertexai.evaluation.PointwiseMetric
vertexai.evaluation.PointwiseMetricPromptTemplate
PointwiseMetricPromptTemplate(
*,
criteria: typing.Dict[str, str],
rating_rubric: typing.Dict[str, str],
input_variables: typing.Optional[typing.List[str]] = None,
instruction: typing.Optional[str] = None,
metric_definition: typing.Optional[str] = None,
evaluation_steps: typing.Optional[typing.Dict[str, str]] = None,
few_shot_examples: typing.Optional[typing.List[str]] = None
)
Initializes a pointwise metric prompt template.
vertexai.evaluation.PointwiseMetricPromptTemplate.__str__
__str__()
Serializes the pointwise metric prompt template to a string.
See more: vertexai.evaluation.PointwiseMetricPromptTemplate.str
vertexai.evaluation.PointwiseMetricPromptTemplate.assemble
assemble(**kwargs) -> vertexai.evaluation.prompt_template.PromptTemplate
Replaces only the provided variables in the template with specific values.
See more: vertexai.evaluation.PointwiseMetricPromptTemplate.assemble
vertexai.evaluation.PointwiseMetricPromptTemplate.get_default_pointwise_evaluation_steps
get_default_pointwise_evaluation_steps() -> typing.Dict[str, str]
Returns the default evaluation steps for the metric prompt template.
See more: vertexai.evaluation.PointwiseMetricPromptTemplate.get_default_pointwise_evaluation_steps
vertexai.evaluation.PointwiseMetricPromptTemplate.get_default_pointwise_instruction
get_default_pointwise_instruction() -> str
Returns the default instruction for the metric prompt template.
See more: vertexai.evaluation.PointwiseMetricPromptTemplate.get_default_pointwise_instruction
vertexai.evaluation.PromptTemplate
PromptTemplate(template: str)
Initializes the PromptTemplate with a given template.
See more: vertexai.evaluation.PromptTemplate
vertexai.evaluation.PromptTemplate.__repr__
__repr__() -> str
Returns a string representation of the PromptTemplate.
See more: vertexai.evaluation.PromptTemplate.repr
vertexai.evaluation.PromptTemplate.__str__
__str__() -> str
Returns the template string.
See more: vertexai.evaluation.PromptTemplate.str
vertexai.evaluation.PromptTemplate.assemble
assemble(**kwargs) -> vertexai.evaluation.prompt_template.PromptTemplate
Replaces only the provided variables in the template with specific values.
vertexai.evaluation.Rouge
Rouge(
*,
rouge_type: typing.Literal[
"rouge1",
"rouge2",
"rouge3",
"rouge4",
"rouge5",
"rouge6",
"rouge7",
"rouge8",
"rouge9",
"rougeL",
"rougeLsum",
],
use_stemmer: bool = False,
split_summaries: bool = False
)
Initializes the ROUGE metric.
See more: vertexai.evaluation.Rouge
vertexai.generative_models.ChatSession.send_message
Generates content.
See more: vertexai.generative_models.ChatSession.send_message
vertexai.generative_models.ChatSession.send_message_async
Generates content asynchronously.
See more: vertexai.generative_models.ChatSession.send_message_async
vertexai.generative_models.FunctionDeclaration
FunctionDeclaration(
*,
name: str,
parameters: typing.Dict[str, typing.Any],
description: typing.Optional[str] = None,
response: typing.Optional[typing.Dict[str, typing.Any]] = None
)
Constructs a FunctionDeclaration.
vertexai.generative_models.GenerationConfig
GenerationConfig(
*,
temperature: typing.Optional[float] = None,
top_p: typing.Optional[float] = None,
top_k: typing.Optional[int] = None,
candidate_count: typing.Optional[int] = None,
max_output_tokens: typing.Optional[int] = None,
stop_sequences: typing.Optional[typing.List[str]] = None,
presence_penalty: typing.Optional[float] = None,
frequency_penalty: typing.Optional[float] = None,
response_mime_type: typing.Optional[str] = None,
response_schema: typing.Optional[typing.Dict[str, typing.Any]] = None,
seed: typing.Optional[int] = None,
audio_timestamp: typing.Optional[bool] = None,
routing_config: typing.Optional[RoutingConfig] = None,
logprobs: typing.Optional[int] = None,
response_logprobs: typing.Optional[bool] = None
)
Constructs a GenerationConfig object.
vertexai.generative_models.GenerationConfig.RoutingConfig.AutoRoutingMode
AutoRoutingMode(
*,
model_routing_preference: google.cloud.aiplatform_v1beta1.types.content.GenerationConfig.RoutingConfig.AutoRoutingMode.ModelRoutingPreference
)
AutoRouingMode constructor .
See more: vertexai.generative_models.GenerationConfig.RoutingConfig.AutoRoutingMode
vertexai.generative_models.GenerationConfig.RoutingConfig.ManualRoutingMode
ManualRoutingMode(*, model_name: str)
ManualRoutingMode constructor .
See more: vertexai.generative_models.GenerationConfig.RoutingConfig.ManualRoutingMode
vertexai.generative_models.GenerativeModel.compute_tokens
compute_tokens(
contents: typing.Union[
typing.List[vertexai.generative_models._generative_models.Content],
typing.List[typing.Dict[str, typing.Any]],
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
typing.List[
typing.Union[
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
]
],
]
) -> google.cloud.aiplatform_v1beta1.types.llm_utility_service.ComputeTokensResponse
Computes tokens.
See more: vertexai.generative_models.GenerativeModel.compute_tokens
vertexai.generative_models.GenerativeModel.compute_tokens_async
compute_tokens_async(
contents: typing.Union[
typing.List[vertexai.generative_models._generative_models.Content],
typing.List[typing.Dict[str, typing.Any]],
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
typing.List[
typing.Union[
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
]
],
]
) -> google.cloud.aiplatform_v1beta1.types.llm_utility_service.ComputeTokensResponse
Computes tokens asynchronously.
See more: vertexai.generative_models.GenerativeModel.compute_tokens_async
vertexai.generative_models.GenerativeModel.count_tokens
count_tokens(
contents: typing.Union[
typing.List[vertexai.generative_models._generative_models.Content],
typing.List[typing.Dict[str, typing.Any]],
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
typing.List[
typing.Union[
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
]
],
],
*,
tools: typing.Optional[
typing.List[vertexai.generative_models._generative_models.Tool]
] = None
) -> google.cloud.aiplatform_v1beta1.types.prediction_service.CountTokensResponse
Counts tokens.
See more: vertexai.generative_models.GenerativeModel.count_tokens
vertexai.generative_models.GenerativeModel.count_tokens_async
count_tokens_async(
contents: typing.Union[
typing.List[vertexai.generative_models._generative_models.Content],
typing.List[typing.Dict[str, typing.Any]],
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
typing.List[
typing.Union[
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
]
],
],
*,
tools: typing.Optional[
typing.List[vertexai.generative_models._generative_models.Tool]
] = None
) -> google.cloud.aiplatform_v1beta1.types.prediction_service.CountTokensResponse
Counts tokens asynchronously.
See more: vertexai.generative_models.GenerativeModel.count_tokens_async
vertexai.generative_models.GenerativeModel.generate_content
generate_content(
contents: typing.Union[
typing.List[vertexai.generative_models._generative_models.Content],
typing.List[typing.Dict[str, typing.Any]],
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
typing.List[
typing.Union[
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
]
],
],
*,
generation_config: typing.Optional[
typing.Union[
vertexai.generative_models._generative_models.GenerationConfig,
typing.Dict[str, typing.Any],
]
] = None,
safety_settings: typing.Optional[
typing.Union[
typing.List[vertexai.generative_models._generative_models.SafetySetting],
typing.Dict[
google.cloud.aiplatform_v1beta1.types.content.HarmCategory,
google.cloud.aiplatform_v1beta1.types.content.SafetySetting.HarmBlockThreshold,
],
]
] = None,
tools: typing.Optional[
typing.List[vertexai.generative_models._generative_models.Tool]
] = None,
tool_config: typing.Optional[
vertexai.generative_models._generative_models.ToolConfig
] = None,
labels: typing.Optional[typing.Dict[str, str]] = None,
stream: bool = False
) -> typing.Union[
vertexai.generative_models._generative_models.GenerationResponse,
typing.Iterable[vertexai.generative_models._generative_models.GenerationResponse],
]
Generates content.
See more: vertexai.generative_models.GenerativeModel.generate_content
vertexai.generative_models.GenerativeModel.generate_content_async
generate_content_async(
contents: typing.Union[
typing.List[vertexai.generative_models._generative_models.Content],
typing.List[typing.Dict[str, typing.Any]],
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
typing.List[
typing.Union[
str,
vertexai.generative_models._generative_models.Image,
vertexai.generative_models._generative_models.Part,
]
],
],
*,
generation_config: typing.Optional[
typing.Union[
vertexai.generative_models._generative_models.GenerationConfig,
typing.Dict[str, typing.Any],
]
] = None,
safety_settings: typing.Optional[
typing.Union[
typing.List[vertexai.generative_models._generative_models.SafetySetting],
typing.Dict[
google.cloud.aiplatform_v1beta1.types.content.HarmCategory,
google.cloud.aiplatform_v1beta1.types.content.SafetySetting.HarmBlockThreshold,
],
]
] = None,
tools: typing.Optional[
typing.List[vertexai.generative_models._generative_models.Tool]
] = None,
tool_config: typing.Optional[
vertexai.generative_models._generative_models.ToolConfig
] = None,
labels: typing.Optional[typing.Dict[str, str]] = None,
stream: bool = False
) -> typing.Union[
vertexai.generative_models._generative_models.GenerationResponse,
typing.AsyncIterable[
vertexai.generative_models._generative_models.GenerationResponse
],
]
Generates content asynchronously.
See more: vertexai.generative_models.GenerativeModel.generate_content_async
vertexai.generative_models.GenerativeModel.start_chat
start_chat(
*,
history: typing.Optional[
typing.List[vertexai.generative_models._generative_models.Content]
] = None,
response_validation: bool = True
) -> vertexai.generative_models._generative_models.ChatSession
Creates a stateful chat session.
See more: vertexai.generative_models.GenerativeModel.start_chat
vertexai.generative_models.Image.from_bytes
from_bytes(data: bytes) -> vertexai.generative_models._generative_models.Image
Loads image from image bytes.
vertexai.generative_models.Image.load_from_file
load_from_file(
location: str,
) -> vertexai.generative_models._generative_models.Image
Loads image from file.
vertexai.generative_models.ResponseValidationError.with_traceback
Exception.with_traceback(tb) -- set self.traceback to tb and return self.
See more: vertexai.generative_models.ResponseValidationError.with_traceback
vertexai.generative_models.SafetySetting
SafetySetting(
*,
category: google.cloud.aiplatform_v1beta1.types.content.HarmCategory,
threshold: google.cloud.aiplatform_v1beta1.types.content.SafetySetting.HarmBlockThreshold,
method: typing.Optional[
google.cloud.aiplatform_v1beta1.types.content.SafetySetting.HarmBlockMethod
] = None
)
Safety settings.
See more: vertexai.generative_models.SafetySetting
vertexai.generative_models.grounding.DynamicRetrievalConfig
DynamicRetrievalConfig(
mode: google.cloud.aiplatform_v1beta1.types.tool.DynamicRetrievalConfig.Mode = Mode.MODE_UNSPECIFIED,
dynamic_threshold: typing.Optional[float] = None,
)
Initializes a DynamicRetrievalConfig.
See more: vertexai.generative_models.grounding.DynamicRetrievalConfig
vertexai.generative_models.grounding.GoogleSearchRetrieval
GoogleSearchRetrieval(
dynamic_retrieval_config: typing.Optional[
vertexai.generative_models._generative_models.grounding.DynamicRetrievalConfig
] = None,
)
Initializes a Google Search Retrieval tool.
See more: vertexai.generative_models.grounding.GoogleSearchRetrieval
vertexai.generative_models.grounding.Retrieval
Retrieval(
source: vertexai.generative_models._generative_models.grounding.VertexAISearch,
disable_attribution: typing.Optional[bool] = None,
)
Initializes a Retrieval tool.
vertexai.generative_models.grounding.VertexAISearch
VertexAISearch(
datastore: str,
*,
project: typing.Optional[str] = None,
location: typing.Optional[str] = None
)
Initializes a Vertex AI Search tool.
See more: vertexai.generative_models.grounding.VertexAISearch
vertexai.language_models.ChatModel
ChatModel(model_id: str, endpoint_name: typing.Optional[str] = None)
Creates a LanguageModel.
See more: vertexai.language_models.ChatModel
vertexai.language_models.ChatModel.from_pretrained
from_pretrained(model_name: str) -> vertexai._model_garden._model_garden_models.T
Loads a _ModelGardenModel.
See more: vertexai.language_models.ChatModel.from_pretrained
vertexai.language_models.ChatModel.get_tuned_model
get_tuned_model(
tuned_model_name: str,
) -> vertexai.language_models._language_models._LanguageModel
Loads the specified tuned language model.
See more: vertexai.language_models.ChatModel.get_tuned_model
vertexai.language_models.ChatModel.list_tuned_model_names
list_tuned_model_names() -> typing.Sequence[str]
Lists the names of tuned models.
See more: vertexai.language_models.ChatModel.list_tuned_model_names
vertexai.language_models.ChatModel.start_chat
start_chat(
*,
context: typing.Optional[str] = None,
examples: typing.Optional[
typing.List[vertexai.language_models.InputOutputTextPair]
] = None,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
top_k: typing.Optional[int] = None,
top_p: typing.Optional[float] = None,
message_history: typing.Optional[
typing.List[vertexai.language_models.ChatMessage]
] = None,
stop_sequences: typing.Optional[typing.List[str]] = None
) -> vertexai.language_models.ChatSession
Starts a chat session with the model.
vertexai.language_models.ChatModel.tune_model
tune_model(
training_data: typing.Union[str, pandas.core.frame.DataFrame],
*,
train_steps: typing.Optional[int] = None,
learning_rate_multiplier: typing.Optional[float] = None,
tuning_job_location: typing.Optional[str] = None,
tuned_model_location: typing.Optional[str] = None,
model_display_name: typing.Optional[str] = None,
default_context: typing.Optional[str] = None,
accelerator_type: typing.Optional[typing.Literal["TPU", "GPU"]] = None,
tuning_evaluation_spec: typing.Optional[
vertexai.language_models.TuningEvaluationSpec
] = None
) -> vertexai.language_models._language_models._LanguageModelTuningJob
Tunes a model based on training data.
vertexai.language_models.ChatModel.tune_model_rlhf
tune_model_rlhf(
*,
prompt_data: typing.Union[str, pandas.core.frame.DataFrame],
preference_data: typing.Union[str, pandas.core.frame.DataFrame],
model_display_name: typing.Optional[str] = None,
prompt_sequence_length: typing.Optional[int] = None,
target_sequence_length: typing.Optional[int] = None,
reward_model_learning_rate_multiplier: typing.Optional[float] = None,
reinforcement_learning_rate_multiplier: typing.Optional[float] = None,
reward_model_train_steps: typing.Optional[int] = None,
reinforcement_learning_train_steps: typing.Optional[int] = None,
kl_coeff: typing.Optional[float] = None,
default_context: typing.Optional[str] = None,
tuning_job_location: typing.Optional[str] = None,
accelerator_type: typing.Optional[typing.Literal["TPU", "GPU"]] = None,
tuning_evaluation_spec: typing.Optional[
vertexai.language_models.TuningEvaluationSpec
] = None
) -> vertexai.language_models._language_models._LanguageModelTuningJob
Tunes a model using reinforcement learning from human feedback.
See more: vertexai.language_models.ChatModel.tune_model_rlhf
vertexai.language_models.ChatSession.send_message
send_message(
message: str,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
top_k: typing.Optional[int] = None,
top_p: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None,
candidate_count: typing.Optional[int] = None,
grounding_source: typing.Optional[
typing.Union[
vertexai.language_models._language_models.WebSearch,
vertexai.language_models._language_models.VertexAISearch,
vertexai.language_models._language_models.InlineContext,
]
] = None
) -> vertexai.language_models.MultiCandidateTextGenerationResponse
Sends message to the language model and gets a response.
vertexai.language_models.ChatSession.send_message_async
send_message_async(
message: str,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
top_k: typing.Optional[int] = None,
top_p: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None,
candidate_count: typing.Optional[int] = None,
grounding_source: typing.Optional[
typing.Union[
vertexai.language_models._language_models.WebSearch,
vertexai.language_models._language_models.VertexAISearch,
vertexai.language_models._language_models.InlineContext,
]
] = None
) -> vertexai.language_models.MultiCandidateTextGenerationResponse
Asynchronously sends message to the language model and gets a response.
See more: vertexai.language_models.ChatSession.send_message_async
vertexai.language_models.ChatSession.send_message_streaming
send_message_streaming(
message: str,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
top_k: typing.Optional[int] = None,
top_p: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None
) -> typing.Iterator[vertexai.language_models.TextGenerationResponse]
Sends message to the language model and gets a streamed response.
See more: vertexai.language_models.ChatSession.send_message_streaming
vertexai.language_models.ChatSession.send_message_streaming_async
send_message_streaming_async(
message: str,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
top_k: typing.Optional[int] = None,
top_p: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None
) -> typing.AsyncIterator[vertexai.language_models.TextGenerationResponse]
Asynchronously sends message to the language model and gets a streamed response.
See more: vertexai.language_models.ChatSession.send_message_streaming_async
vertexai.language_models.CodeChatModel
CodeChatModel(model_id: str, endpoint_name: typing.Optional[str] = None)
Creates a LanguageModel.
See more: vertexai.language_models.CodeChatModel
vertexai.language_models.CodeChatModel.from_pretrained
from_pretrained(model_name: str) -> vertexai._model_garden._model_garden_models.T
Loads a _ModelGardenModel.
See more: vertexai.language_models.CodeChatModel.from_pretrained
vertexai.language_models.CodeChatModel.get_tuned_model
get_tuned_model(
tuned_model_name: str,
) -> vertexai.language_models._language_models._LanguageModel
Loads the specified tuned language model.
See more: vertexai.language_models.CodeChatModel.get_tuned_model
vertexai.language_models.CodeChatModel.list_tuned_model_names
list_tuned_model_names() -> typing.Sequence[str]
Lists the names of tuned models.
See more: vertexai.language_models.CodeChatModel.list_tuned_model_names
vertexai.language_models.CodeChatModel.start_chat
start_chat(
*,
context: typing.Optional[str] = None,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
message_history: typing.Optional[
typing.List[vertexai.language_models.ChatMessage]
] = None,
stop_sequences: typing.Optional[typing.List[str]] = None
) -> vertexai.language_models.CodeChatSession
Starts a chat session with the code chat model.
vertexai.language_models.CodeChatModel.tune_model
tune_model(
training_data: typing.Union[str, pandas.core.frame.DataFrame],
*,
train_steps: typing.Optional[int] = None,
learning_rate_multiplier: typing.Optional[float] = None,
tuning_job_location: typing.Optional[str] = None,
tuned_model_location: typing.Optional[str] = None,
model_display_name: typing.Optional[str] = None,
default_context: typing.Optional[str] = None,
accelerator_type: typing.Optional[typing.Literal["TPU", "GPU"]] = None,
tuning_evaluation_spec: typing.Optional[
vertexai.language_models.TuningEvaluationSpec
] = None
) -> vertexai.language_models._language_models._LanguageModelTuningJob
Tunes a model based on training data.
vertexai.language_models.CodeChatSession.send_message
send_message(
message: str,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None,
candidate_count: typing.Optional[int] = None
) -> vertexai.language_models.MultiCandidateTextGenerationResponse
Sends message to the code chat model and gets a response.
See more: vertexai.language_models.CodeChatSession.send_message
vertexai.language_models.CodeChatSession.send_message_async
send_message_async(
message: str,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
candidate_count: typing.Optional[int] = None
) -> vertexai.language_models.MultiCandidateTextGenerationResponse
Asynchronously sends message to the code chat model and gets a response.
See more: vertexai.language_models.CodeChatSession.send_message_async
vertexai.language_models.CodeChatSession.send_message_streaming
send_message_streaming(
message: str,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None
) -> typing.Iterator[vertexai.language_models.TextGenerationResponse]
Sends message to the language model and gets a streamed response.
See more: vertexai.language_models.CodeChatSession.send_message_streaming
vertexai.language_models.CodeChatSession.send_message_streaming_async
send_message_streaming_async(
message: str,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None
) -> typing.AsyncIterator[vertexai.language_models.TextGenerationResponse]
Asynchronously sends message to the language model and gets a streamed response.
See more: vertexai.language_models.CodeChatSession.send_message_streaming_async
vertexai.language_models.CodeGenerationModel.batch_predict
batch_predict(
*,
dataset: typing.Union[str, typing.List[str]],
destination_uri_prefix: str,
model_parameters: typing.Optional[typing.Dict] = None
) -> google.cloud.aiplatform.jobs.BatchPredictionJob
Starts a batch prediction job with the model.
See more: vertexai.language_models.CodeGenerationModel.batch_predict
vertexai.language_models.CodeGenerationModel.from_pretrained
from_pretrained(model_name: str) -> vertexai._model_garden._model_garden_models.T
Loads a _ModelGardenModel.
See more: vertexai.language_models.CodeGenerationModel.from_pretrained
vertexai.language_models.CodeGenerationModel.get_tuned_model
get_tuned_model(
tuned_model_name: str,
) -> vertexai.language_models._language_models._LanguageModel
Loads the specified tuned language model.
See more: vertexai.language_models.CodeGenerationModel.get_tuned_model
vertexai.language_models.CodeGenerationModel.list_tuned_model_names
list_tuned_model_names() -> typing.Sequence[str]
Lists the names of tuned models.
See more: vertexai.language_models.CodeGenerationModel.list_tuned_model_names
vertexai.language_models.CodeGenerationModel.predict
predict(
prefix: str,
suffix: typing.Optional[str] = None,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None,
candidate_count: typing.Optional[int] = None
) -> vertexai.language_models.TextGenerationResponse
Gets model response for a single prompt.
See more: vertexai.language_models.CodeGenerationModel.predict
vertexai.language_models.CodeGenerationModel.predict_async
predict_async(
prefix: str,
suffix: typing.Optional[str] = None,
*,
max_output_tokens: typing.Optional[int] = None,
temperature: typing.Optional[float] = None,
stop_sequences: typing.Optional[typing.List[str]] = None,
candidate_count: typing.Optional[int] = None
) -> vertexai