GeezerVison is showing github.com — Copybara import of the project: · smbale/python-aiplatform@688f1b9
File treeExpand file treeCollapse file tree Open diff view settings services/prediction_service
samples/generated_samples
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/__init__.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 101 | 101 | from .types.content import GroundingChunk | 102 | 102 | from .types.content import GroundingMetadata | 103 | 103 | from .types.content import GroundingSupport | | 104 | +from .types.content import LogprobsResult | 104 | 105 | from .types.content import Part | 105 | 106 | from .types.content import SafetyRating | 106 | 107 | from .types.content import SafetySetting | | 1423 | 1424 | "ListTuningJobsRequest", | 1424 | 1425 | "ListTuningJobsResponse", | 1425 | 1426 | "LlmUtilityServiceClient", | | 1427 | + "LogprobsResult", | 1426 | 1428 | "LookupStudyRequest", | 1427 | 1429 | "MachineSpec", | 1428 | 1430 | "ManualBatchTuningParameters", | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/types/__init__.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 42 | 42 | GroundingChunk, | 43 | 43 | GroundingMetadata, | 44 | 44 | GroundingSupport, | | 45 | + LogprobsResult, | 45 | 46 | Part, | 46 | 47 | SafetyRating, | 47 | 48 | SafetySetting, | | 1060 | 1061 | "GroundingChunk", | 1061 | 1062 | "GroundingMetadata", | 1062 | 1063 | "GroundingSupport", | | 1064 | + "LogprobsResult", | 1063 | 1065 | "Part", | 1064 | 1066 | "SafetyRating", | 1065 | 1067 | "SafetySetting", | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/types/content.py +105Lines changed: 105 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 40 | 40 | "CitationMetadata", | 41 | 41 | "Citation", | 42 | 42 | "Candidate", | | 43 | + "LogprobsResult", | 43 | 44 | "Segment", | 44 | 45 | "GroundingChunk", | 45 | 46 | "GroundingSupport", | @@ -64,12 +65,15 @@ class HarmCategory(proto.Enum): | 64 | 65 | HARM_CATEGORY_SEXUALLY_EXPLICIT (4): | 65 | 66 | The harm category is sexually explicit | 66 | 67 | content. | | 68 | + HARM_CATEGORY_CIVIC_INTEGRITY (5): | | 69 | + The harm category is civic integrity. | 67 | 70 | """ | 68 | 71 | HARM_CATEGORY_UNSPECIFIED = 0 | 69 | 72 | HARM_CATEGORY_HATE_SPEECH = 1 | 70 | 73 | HARM_CATEGORY_DANGEROUS_CONTENT = 2 | 71 | 74 | HARM_CATEGORY_HARASSMENT = 3 | 72 | 75 | HARM_CATEGORY_SEXUALLY_EXPLICIT = 4 | | 76 | + HARM_CATEGORY_CIVIC_INTEGRITY = 5 | 73 | 77 |
| 74 | 78 |
| 75 | 79 | class Content(proto.Message): | @@ -294,6 +298,15 @@ class GenerationConfig(proto.Message): | 294 | 298 | This field is a member of `oneof`_ ``_max_output_tokens``. | 295 | 299 | stop_sequences (MutableSequence[str]): | 296 | 300 | Optional. Stop sequences. | | 301 | + response_logprobs (bool): | | 302 | + Optional. If true, export the logprobs | | 303 | + results in response. | | 304 | +
| | 305 | + This field is a member of `oneof`_ ``_response_logprobs``. | | 306 | + logprobs (int): | | 307 | + Optional. Logit probabilities. | | 308 | +
| | 309 | + This field is a member of `oneof`_ ``_logprobs``. | 297 | 310 | presence_penalty (float): | 298 | 311 | Optional. Positive penalties. | 299 | 312 |
| @@ -457,6 +470,16 @@ class ManualRoutingMode(proto.Message): | 457 | 470 | proto.STRING, | 458 | 471 | number=6, | 459 | 472 | ) | | 473 | + response_logprobs: bool = proto.Field( | | 474 | + proto.BOOL, | | 475 | + number=18, | | 476 | + optional=True, | | 477 | + ) | | 478 | + logprobs: int = proto.Field( | | 479 | + proto.INT32, | | 480 | + number=7, | | 481 | + optional=True, | | 482 | + ) | 460 | 483 | presence_penalty: float = proto.Field( | 461 | 484 | proto.FLOAT, | 462 | 485 | number=8, | @@ -734,6 +757,9 @@ class Candidate(proto.Message): | 734 | 757 | avg_logprobs (float): | 735 | 758 | Output only. Average log probability score of | 736 | 759 | the candidate. | | 760 | + logprobs_result (google.cloud.aiplatform_v1.types.LogprobsResult): | | 761 | + Output only. Log-likelihood scores for the | | 762 | + response tokens and top tokens | 737 | 763 | finish_reason (google.cloud.aiplatform_v1.types.Candidate.FinishReason): | 738 | 764 | Output only. The reason why the model stopped | 739 | 765 | generating tokens. If empty, the model has not | @@ -822,6 +848,11 @@ class FinishReason(proto.Enum): | 822 | 848 | proto.DOUBLE, | 823 | 849 | number=9, | 824 | 850 | ) | | 851 | + logprobs_result: "LogprobsResult" = proto.Field( | | 852 | + proto.MESSAGE, | | 853 | + number=10, | | 854 | + message="LogprobsResult", | | 855 | + ) | 825 | 856 | finish_reason: FinishReason = proto.Field( | 826 | 857 | proto.ENUM, | 827 | 858 | number=3, | @@ -849,6 +880,80 @@ class FinishReason(proto.Enum): | 849 | 880 | ) | 850 | 881 |
| 851 | 882 |
| | 883 | +class LogprobsResult(proto.Message): | | 884 | + r"""Logprobs Result | | 885 | +
| | 886 | + Attributes: | | 887 | + top_candidates (MutableSequence[google.cloud.aiplatform_v1.types.LogprobsResult.TopCandidates]): | | 888 | + Length = total number of decoding steps. | | 889 | + chosen_candidates (MutableSequence[google.cloud.aiplatform_v1.types.LogprobsResult.Candidate]): | | 890 | + Length = total number of decoding steps. The chosen | | 891 | + candidates may or may not be in top_candidates. | | 892 | + """ | | 893 | + | | 894 | + class Candidate(proto.Message): | | 895 | + r"""Candidate for the logprobs token and score. | | 896 | +
| | 897 | + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields | | 898 | +
| | 899 | + Attributes: | | 900 | + token (str): | | 901 | + The candidate’s token string value. | | 902 | +
| | 903 | + This field is a member of `oneof`_ ``_token``. | | 904 | + token_id (int): | | 905 | + The candidate’s token id value. | | 906 | +
| | 907 | + This field is a member of `oneof`_ ``_token_id``. | | 908 | + log_probability (float): | | 909 | + The candidate's log probability. | | 910 | +
| | 911 | + This field is a member of `oneof`_ ``_log_probability``. | | 912 | + """ | | 913 | + | | 914 | + token: str = proto.Field( | | 915 | + proto.STRING, | | 916 | + number=1, | | 917 | + optional=True, | | 918 | + ) | | 919 | + token_id: int = proto.Field( | | 920 | + proto.INT32, | | 921 | + number=3, | | 922 | + optional=True, | | 923 | + ) | | 924 | + log_probability: float = proto.Field( | | 925 | + proto.FLOAT, | | 926 | + number=2, | | 927 | + optional=True, | | 928 | + ) | | 929 | + | | 930 | + class TopCandidates(proto.Message): | | 931 | + r"""Candidates with top log probabilities at each decoding step. | | 932 | +
| | 933 | + Attributes: | | 934 | + candidates (MutableSequence[google.cloud.aiplatform_v1.types.LogprobsResult.Candidate]): | | 935 | + Sorted by log probability in descending | | 936 | + order. | | 937 | + """ | | 938 | + | | 939 | + candidates: MutableSequence["LogprobsResult.Candidate"] = proto.RepeatedField( | | 940 | + proto.MESSAGE, | | 941 | + number=1, | | 942 | + message="LogprobsResult.Candidate", | | 943 | + ) | | 944 | + | | 945 | + top_candidates: MutableSequence[TopCandidates] = proto.RepeatedField( | | 946 | + proto.MESSAGE, | | 947 | + number=1, | | 948 | + message=TopCandidates, | | 949 | + ) | | 950 | + chosen_candidates: MutableSequence[Candidate] = proto.RepeatedField( | | 951 | + proto.MESSAGE, | | 952 | + number=2, | | 953 | + message=Candidate, | | 954 | + ) | | 955 | + | | 956 | + | 852 | 957 | class Segment(proto.Message): | 853 | 958 | r"""Segment of the content. | 854 | 959 |
| |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/types/openapi.py +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -131,6 +131,10 @@ class Schema(proto.Message): | 131 | 131 | example (google.protobuf.struct_pb2.Value): | 132 | 132 | Optional. Example of the object. Will only | 133 | 133 | populated when the object is the root. | | 134 | + any_of (MutableSequence[google.cloud.aiplatform_v1.types.Schema]): | | 135 | + Optional. The value should be validated | | 136 | + against any (one or more) of the subschemas in | | 137 | + the list. | 134 | 138 | """ | 135 | 139 |
| 136 | 140 | type_: "Type" = proto.Field( | @@ -223,6 +227,11 @@ class Schema(proto.Message): | 223 | 227 | number=4, | 224 | 228 | message=struct_pb2.Value, | 225 | 229 | ) | | 230 | + any_of: MutableSequence["Schema"] = proto.RepeatedField( | | 231 | + proto.MESSAGE, | | 232 | + number=11, | | 233 | + message="Schema", | | 234 | + ) | 226 | 235 |
| 227 | 236 |
| 228 | 237 | __all__ = tuple(sorted(__protobuf__.manifest)) |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/types/prediction_service.py +36-1Lines changed: 36 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -709,6 +709,11 @@ class CountTokensRequest(proto.Message): | 709 | 709 | A ``Tool`` is a piece of code that enables the system to | 710 | 710 | interact with external systems to perform an action, or set | 711 | 711 | of actions, outside of knowledge and scope of the model. | | 712 | + generation_config (google.cloud.aiplatform_v1.types.GenerationConfig): | | 713 | + Optional. Generation config that the model | | 714 | + will use to generate the response. | | 715 | +
| | 716 | + This field is a member of `oneof`_ ``_generation_config``. | 712 | 717 | """ | 713 | 718 |
| 714 | 719 | endpoint: str = proto.Field( | @@ -740,6 +745,12 @@ class CountTokensRequest(proto.Message): | 740 | 745 | number=6, | 741 | 746 | message=tool.Tool, | 742 | 747 | ) | | 748 | + generation_config: content.GenerationConfig = proto.Field( | | 749 | + proto.MESSAGE, | | 750 | + number=7, | | 751 | + optional=True, | | 752 | + message=content.GenerationConfig, | | 753 | + ) | 743 | 754 |
| 744 | 755 |
| 745 | 756 | class CountTokensResponse(proto.Message): | @@ -803,6 +814,17 @@ class GenerateContentRequest(proto.Message): | 803 | 814 | tool_config (google.cloud.aiplatform_v1.types.ToolConfig): | 804 | 815 | Optional. Tool config. This config is shared | 805 | 816 | for all tools provided in the request. | | 817 | + labels (MutableMapping[str, str]): | | 818 | + Optional. The labels with user-defined | | 819 | + metadata for the request. It is used for billing | | 820 | + and reporting only. | | 821 | +
| | 822 | + Label keys and values can be no longer than 63 | | 823 | + characters (Unicode codepoints) and can only | | 824 | + contain lowercase letters, numeric characters, | | 825 | + underscores, and dashes. International | | 826 | + characters are allowed. Label values are | | 827 | + optional. Label keys must start with a letter. | 806 | 828 | safety_settings (MutableSequence[google.cloud.aiplatform_v1.types.SafetySetting]): | 807 | 829 | Optional. Per request settings for blocking | 808 | 830 | unsafe content. Enforced on | @@ -836,6 +858,11 @@ class GenerateContentRequest(proto.Message): | 836 | 858 | number=7, | 837 | 859 | message=tool.ToolConfig, | 838 | 860 | ) | | 861 | + labels: MutableMapping[str, str] = proto.MapField( | | 862 | + proto.STRING, | | 863 | + proto.STRING, | | 864 | + number=10, | | 865 | + ) | 839 | 866 | safety_settings: MutableSequence[content.SafetySetting] = proto.RepeatedField( | 840 | 867 | proto.MESSAGE, | 841 | 868 | number=3, | @@ -854,6 +881,9 @@ class GenerateContentResponse(proto.Message): | 854 | 881 | Attributes: | 855 | 882 | candidates (MutableSequence[google.cloud.aiplatform_v1.types.Candidate]): | 856 | 883 | Output only. Generated candidates. | | 884 | + model_version (str): | | 885 | + Output only. The model version used to | | 886 | + generate the response. | 857 | 887 | prompt_feedback (google.cloud.aiplatform_v1.types.GenerateContentResponse.PromptFeedback): | 858 | 888 | Output only. Content filter results for a | 859 | 889 | prompt sent in the request. Note: Sent only in | @@ -926,7 +956,8 @@ class UsageMetadata(proto.Message): | 926 | 956 | candidates_token_count (int): | 927 | 957 | Number of tokens in the response(s). | 928 | 958 | total_token_count (int): | 929 | | -
| | 959 | + Total token count for prompt and response | | 960 | + candidates. | 930 | 961 | """ | 931 | 962 |
| 932 | 963 | prompt_token_count: int = proto.Field( | @@ -947,6 +978,10 @@ class UsageMetadata(proto.Message): | 947 | 978 | number=2, | 948 | 979 | message=content.Candidate, | 949 | 980 | ) | | 981 | + model_version: str = proto.Field( | | 982 | + proto.STRING, | | 983 | + number=11, | | 984 | + ) | 950 | 985 | prompt_feedback: PromptFeedback = proto.Field( | 951 | 986 | proto.MESSAGE, | 952 | 987 | number=3, | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1beta1/__init__.py +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 123 | 123 | from .types.content import GroundingChunk | 124 | 124 | from .types.content import GroundingMetadata | 125 | 125 | from .types.content import GroundingSupport | | 126 | +from .types.content import LogprobsResult | 126 | 127 | from .types.content import Part | 127 | 128 | from .types.content import SafetyRating | 128 | 129 | from .types.content import SafetySetting | | 822 | 823 | from .types.pipeline_job import PipelineJobDetail | 823 | 824 | from .types.pipeline_job import PipelineTaskDetail | 824 | 825 | from .types.pipeline_job import PipelineTaskExecutorDetail | | 826 | +from .types.pipeline_job import PipelineTaskRerunConfig | 825 | 827 | from .types.pipeline_job import PipelineTemplateMetadata | 826 | 828 | from .types.pipeline_service import BatchCancelPipelineJobsOperationMetadata | 827 | 829 | from .types.pipeline_service import BatchCancelPipelineJobsRequest | | 893 | 895 | from .types.schedule_service import UpdateScheduleRequest | 894 | 896 | from .types.service_networking import PrivateServiceConnectConfig | 895 | 897 | from .types.service_networking import PscAutomatedEndpoints | | 898 | +from .types.service_networking import PSCAutomationConfig | 896 | 899 | from .types.service_networking import PscInterfaceConfig | 897 | 900 | from .types.specialist_pool import SpecialistPool | 898 | 901 | from .types.specialist_pool_service import CreateSpecialistPoolOperationMetadata | | 1000 | 1003 | from .types.types import Int64Array | 1001 | 1004 | from .types.types import StringArray | 1002 | 1005 | from .types.types import Tensor | | 1006 | +from .types.ui_pipeline_spec import ArtifactTypeSchema | | 1007 | +from .types.ui_pipeline_spec import RuntimeArtifact | 1003 | 1008 | from .types.unmanaged_container_model import UnmanagedContainerModel | 1004 | 1009 | from .types.user_action_reference import UserActionReference | 1005 | 1010 | from .types.value import Value | | 1106 | 1111 | "AnnotationSpec", | 1107 | 1112 | "ApiAuth", | 1108 | 1113 | "Artifact", | | 1114 | + "ArtifactTypeSchema", | 1109 | 1115 | "AssignNotebookRuntimeOperationMetadata", | 1110 | 1116 | "AssignNotebookRuntimeRequest", | 1111 | 1117 | "Attribution", | | 1644 | 1650 | "ListTuningJobsRequest", | 1645 | 1651 | "ListTuningJobsResponse", | 1646 | 1652 | "LlmUtilityServiceClient", | | 1653 | + "LogprobsResult", | 1647 | 1654 | "LookupStudyRequest", | 1648 | 1655 | "MachineSpec", | 1649 | 1656 | "ManualBatchTuningParameters", | | 1717 | 1724 | "NotebookRuntimeTemplateRef", | 1718 | 1725 | "NotebookRuntimeType", | 1719 | 1726 | "NotebookServiceClient", | | 1727 | + "PSCAutomationConfig", | 1720 | 1728 | "PairwiseChoice", | 1721 | 1729 | "PairwiseMetricInput", | 1722 | 1730 | "PairwiseMetricInstance", | | 1743 | 1751 | "PipelineState", | 1744 | 1752 | "PipelineTaskDetail", | 1745 | 1753 | "PipelineTaskExecutorDetail", | | 1754 | + "PipelineTaskRerunConfig", | 1746 | 1755 | "PipelineTemplateMetadata", | 1747 | 1756 | "PointwiseMetricInput", | 1748 | 1757 | "PointwiseMetricInstance", | | 1851 | 1860 | "RougeMetricValue", | 1852 | 1861 | "RougeResults", | 1853 | 1862 | "RougeSpec", | | 1863 | + "RuntimeArtifact", | 1854 | 1864 | "RuntimeConfig", | 1855 | 1865 | "SafetyInput", | 1856 | 1866 | "SafetyInstance", | |
|