├── .editorconfig
├── .github
├── labeler.yml
├── pull_request_template.md
└── workflows
│ ├── labeler.yml
│ ├── remove-issue-labels.yml
│ ├── remove-pr-labels.yml
│ ├── samples.yaml
│ ├── stale.yml
│ └── test_pr.yaml
├── .gitignore
├── CODEOWNERS
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── RELEASE.md
├── docs
├── ais-templates
│ ├── aistudio_gemini_prompt_freeform.ipynb
│ └── aistudio_gemini_prompt_freeform_nofiles.ipynb
├── api
│ └── google
│ │ ├── generativeai.md
│ │ └── generativeai
│ │ ├── ChatSession.md
│ │ ├── GenerativeModel.md
│ │ ├── _api_cache.json
│ │ ├── _redirects.yaml
│ │ ├── _toc.yaml
│ │ ├── all_symbols.md
│ │ ├── api_report.pb
│ │ ├── caching.md
│ │ ├── caching
│ │ ├── CachedContent.md
│ │ └── get_default_cache_client.md
│ │ ├── configure.md
│ │ ├── create_tuned_model.md
│ │ ├── delete_file.md
│ │ ├── delete_tuned_model.md
│ │ ├── embed_content.md
│ │ ├── embed_content_async.md
│ │ ├── get_base_model.md
│ │ ├── get_file.md
│ │ ├── get_model.md
│ │ ├── get_operation.md
│ │ ├── get_tuned_model.md
│ │ ├── list_files.md
│ │ ├── list_models.md
│ │ ├── list_operations.md
│ │ ├── list_tuned_models.md
│ │ ├── protos.md
│ │ ├── protos
│ │ ├── AttributionSourceId.md
│ │ ├── AttributionSourceId
│ │ │ ├── GroundingPassageId.md
│ │ │ └── SemanticRetrieverChunk.md
│ │ ├── BatchCreateChunksRequest.md
│ │ ├── BatchCreateChunksResponse.md
│ │ ├── BatchDeleteChunksRequest.md
│ │ ├── BatchEmbedContentsRequest.md
│ │ ├── BatchEmbedContentsResponse.md
│ │ ├── BatchEmbedTextRequest.md
│ │ ├── BatchEmbedTextResponse.md
│ │ ├── BatchUpdateChunksRequest.md
│ │ ├── BatchUpdateChunksResponse.md
│ │ ├── Blob.md
│ │ ├── CachedContent.md
│ │ ├── CachedContent
│ │ │ └── UsageMetadata.md
│ │ ├── Candidate.md
│ │ ├── Candidate
│ │ │ └── FinishReason.md
│ │ ├── Chunk.md
│ │ ├── Chunk
│ │ │ └── State.md
│ │ ├── ChunkData.md
│ │ ├── CitationMetadata.md
│ │ ├── CitationSource.md
│ │ ├── CodeExecution.md
│ │ ├── CodeExecutionResult.md
│ │ ├── CodeExecutionResult
│ │ │ └── Outcome.md
│ │ ├── Condition.md
│ │ ├── Condition
│ │ │ └── Operator.md
│ │ ├── Content.md
│ │ ├── ContentEmbedding.md
│ │ ├── ContentFilter.md
│ │ ├── Corpus.md
│ │ ├── CountMessageTokensRequest.md
│ │ ├── CountMessageTokensResponse.md
│ │ ├── CountTextTokensRequest.md
│ │ ├── CountTextTokensResponse.md
│ │ ├── CountTokensRequest.md
│ │ ├── CountTokensResponse.md
│ │ ├── CreateCachedContentRequest.md
│ │ ├── CreateChunkRequest.md
│ │ ├── CreateCorpusRequest.md
│ │ ├── CreateDocumentRequest.md
│ │ ├── CreateFileRequest.md
│ │ ├── CreateFileResponse.md
│ │ ├── CreatePermissionRequest.md
│ │ ├── CreateTunedModelMetadata.md
│ │ ├── CreateTunedModelRequest.md
│ │ ├── CustomMetadata.md
│ │ ├── Dataset.md
│ │ ├── DeleteCachedContentRequest.md
│ │ ├── DeleteChunkRequest.md
│ │ ├── DeleteCorpusRequest.md
│ │ ├── DeleteDocumentRequest.md
│ │ ├── DeleteFileRequest.md
│ │ ├── DeletePermissionRequest.md
│ │ ├── DeleteTunedModelRequest.md
│ │ ├── Document.md
│ │ ├── DynamicRetrievalConfig.md
│ │ ├── DynamicRetrievalConfig
│ │ │ └── Mode.md
│ │ ├── EmbedContentRequest.md
│ │ ├── EmbedContentResponse.md
│ │ ├── EmbedTextRequest.md
│ │ ├── EmbedTextResponse.md
│ │ ├── Embedding.md
│ │ ├── Example.md
│ │ ├── ExecutableCode.md
│ │ ├── ExecutableCode
│ │ │ └── Language.md
│ │ ├── File.md
│ │ ├── File
│ │ │ └── State.md
│ │ ├── FileData.md
│ │ ├── FunctionCall.md
│ │ ├── FunctionCallingConfig.md
│ │ ├── FunctionCallingConfig
│ │ │ └── Mode.md
│ │ ├── FunctionDeclaration.md
│ │ ├── FunctionResponse.md
│ │ ├── GenerateAnswerRequest.md
│ │ ├── GenerateAnswerRequest
│ │ │ └── AnswerStyle.md
│ │ ├── GenerateAnswerResponse.md
│ │ ├── GenerateAnswerResponse
│ │ │ ├── InputFeedback.md
│ │ │ └── InputFeedback
│ │ │ │ └── BlockReason.md
│ │ ├── GenerateContentRequest.md
│ │ ├── GenerateContentResponse.md
│ │ ├── GenerateContentResponse
│ │ │ ├── PromptFeedback.md
│ │ │ ├── PromptFeedback
│ │ │ │ └── BlockReason.md
│ │ │ └── UsageMetadata.md
│ │ ├── GenerateMessageRequest.md
│ │ ├── GenerateMessageResponse.md
│ │ ├── GenerateTextRequest.md
│ │ ├── GenerateTextResponse.md
│ │ ├── GenerationConfig.md
│ │ ├── GetCachedContentRequest.md
│ │ ├── GetChunkRequest.md
│ │ ├── GetCorpusRequest.md
│ │ ├── GetDocumentRequest.md
│ │ ├── GetFileRequest.md
│ │ ├── GetModelRequest.md
│ │ ├── GetPermissionRequest.md
│ │ ├── GetTunedModelRequest.md
│ │ ├── GoogleSearchRetrieval.md
│ │ ├── GroundingAttribution.md
│ │ ├── GroundingChunk.md
│ │ ├── GroundingChunk
│ │ │ └── Web.md
│ │ ├── GroundingMetadata.md
│ │ ├── GroundingPassage.md
│ │ ├── GroundingPassages.md
│ │ ├── GroundingSupport.md
│ │ ├── HarmCategory.md
│ │ ├── Hyperparameters.md
│ │ ├── ListCachedContentsRequest.md
│ │ ├── ListCachedContentsResponse.md
│ │ ├── ListChunksRequest.md
│ │ ├── ListChunksResponse.md
│ │ ├── ListCorporaRequest.md
│ │ ├── ListCorporaResponse.md
│ │ ├── ListDocumentsRequest.md
│ │ ├── ListDocumentsResponse.md
│ │ ├── ListFilesRequest.md
│ │ ├── ListFilesResponse.md
│ │ ├── ListModelsRequest.md
│ │ ├── ListModelsResponse.md
│ │ ├── ListPermissionsRequest.md
│ │ ├── ListPermissionsResponse.md
│ │ ├── ListTunedModelsRequest.md
│ │ ├── ListTunedModelsResponse.md
│ │ ├── LogprobsResult.md
│ │ ├── LogprobsResult
│ │ │ ├── Candidate.md
│ │ │ └── TopCandidates.md
│ │ ├── Message.md
│ │ ├── MessagePrompt.md
│ │ ├── MetadataFilter.md
│ │ ├── Model.md
│ │ ├── Part.md
│ │ ├── Permission.md
│ │ ├── Permission
│ │ │ ├── GranteeType.md
│ │ │ └── Role.md
│ │ ├── PredictRequest.md
│ │ ├── PredictResponse.md
│ │ ├── QueryCorpusRequest.md
│ │ ├── QueryCorpusResponse.md
│ │ ├── QueryDocumentRequest.md
│ │ ├── QueryDocumentResponse.md
│ │ ├── RelevantChunk.md
│ │ ├── RetrievalMetadata.md
│ │ ├── SafetyFeedback.md
│ │ ├── SafetyRating.md
│ │ ├── SafetySetting.md
│ │ ├── Schema.md
│ │ ├── Schema
│ │ │ └── PropertiesEntry.md
│ │ ├── SearchEntryPoint.md
│ │ ├── Segment.md
│ │ ├── SemanticRetrieverConfig.md
│ │ ├── StringList.md
│ │ ├── TaskType.md
│ │ ├── TextCompletion.md
│ │ ├── TextPrompt.md
│ │ ├── Tool.md
│ │ ├── ToolConfig.md
│ │ ├── TransferOwnershipRequest.md
│ │ ├── TransferOwnershipResponse.md
│ │ ├── TunedModel.md
│ │ ├── TunedModelSource.md
│ │ ├── TuningExample.md
│ │ ├── TuningExamples.md
│ │ ├── TuningSnapshot.md
│ │ ├── TuningTask.md
│ │ ├── Type.md
│ │ ├── UpdateCachedContentRequest.md
│ │ ├── UpdateChunkRequest.md
│ │ ├── UpdateCorpusRequest.md
│ │ ├── UpdateDocumentRequest.md
│ │ ├── UpdatePermissionRequest.md
│ │ ├── UpdateTunedModelRequest.md
│ │ └── VideoMetadata.md
│ │ ├── types.md
│ │ ├── types
│ │ ├── AnyModelNameOptions.md
│ │ ├── AsyncGenerateContentResponse.md
│ │ ├── BaseModelNameOptions.md
│ │ ├── BlobDict.md
│ │ ├── BlobType.md
│ │ ├── BlockedPromptException.md
│ │ ├── BlockedReason.md
│ │ ├── BrokenResponseError.md
│ │ ├── CallableFunctionDeclaration.md
│ │ ├── CitationMetadataDict.md
│ │ ├── CitationSourceDict.md
│ │ ├── ContentDict.md
│ │ ├── ContentFilterDict.md
│ │ ├── ContentType.md
│ │ ├── ContentsType.md
│ │ ├── File.md
│ │ ├── FileDataDict.md
│ │ ├── FileDataType.md
│ │ ├── FunctionDeclaration.md
│ │ ├── FunctionDeclarationType.md
│ │ ├── FunctionLibrary.md
│ │ ├── FunctionLibraryType.md
│ │ ├── GenerateContentResponse.md
│ │ ├── GenerationConfig.md
│ │ ├── GenerationConfigDict.md
│ │ ├── GenerationConfigType.md
│ │ ├── HarmBlockThreshold.md
│ │ ├── HarmCategory.md
│ │ ├── HarmProbability.md
│ │ ├── IncompleteIterationError.md
│ │ ├── Model.md
│ │ ├── ModelsIterable.md
│ │ ├── PartDict.md
│ │ ├── PartType.md
│ │ ├── Permission.md
│ │ ├── Permissions.md
│ │ ├── RequestOptions.md
│ │ ├── RequestOptionsType.md
│ │ ├── SafetyFeedbackDict.md
│ │ ├── SafetyRatingDict.md
│ │ ├── SafetySettingDict.md
│ │ ├── Status.md
│ │ ├── StopCandidateException.md
│ │ ├── StrictContentType.md
│ │ ├── Tool.md
│ │ ├── ToolDict.md
│ │ ├── ToolsType.md
│ │ ├── TunedModel.md
│ │ ├── TunedModelNameOptions.md
│ │ ├── TunedModelState.md
│ │ ├── TypedDict.md
│ │ ├── get_default_file_client.md
│ │ └── to_file_data.md
│ │ ├── update_tuned_model.md
│ │ └── upload_file.md
└── build_docs.py
├── google
└── generativeai
│ ├── __init__.py
│ ├── answer.py
│ ├── caching.py
│ ├── client.py
│ ├── embedding.py
│ ├── files.py
│ ├── generative_models.py
│ ├── models.py
│ ├── notebook
│ ├── __init__.py
│ ├── argument_parser.py
│ ├── cmd_line_parser.py
│ ├── command.py
│ ├── command_utils.py
│ ├── compare_cmd.py
│ ├── compile_cmd.py
│ ├── eval_cmd.py
│ ├── flag_def.py
│ ├── gspread_client.py
│ ├── html_utils.py
│ ├── input_utils.py
│ ├── ipython_env.py
│ ├── ipython_env_impl.py
│ ├── lib
│ │ ├── __init__.py
│ │ ├── llm_function.py
│ │ ├── llmfn_input_utils.py
│ │ ├── llmfn_inputs_source.py
│ │ ├── llmfn_output_row.py
│ │ ├── llmfn_outputs.py
│ │ ├── llmfn_post_process.py
│ │ ├── llmfn_post_process_cmds.py
│ │ ├── model.py
│ │ ├── prompt_utils.py
│ │ └── unique_fn.py
│ ├── magics.py
│ ├── magics_engine.py
│ ├── model_registry.py
│ ├── output_utils.py
│ ├── parsed_args_lib.py
│ ├── post_process_utils.py
│ ├── post_process_utils_test_helper.py
│ ├── py_utils.py
│ ├── run_cmd.py
│ ├── sheets_id.py
│ ├── sheets_sanitize_url.py
│ ├── sheets_utils.py
│ └── text_model.py
│ ├── operations.py
│ ├── permission.py
│ ├── protos.py
│ ├── py.typed
│ ├── responder.py
│ ├── retriever.py
│ ├── string_utils.py
│ ├── types
│ ├── __init__.py
│ ├── answer_types.py
│ ├── caching_types.py
│ ├── citation_types.py
│ ├── content_types.py
│ ├── file_types.py
│ ├── generation_types.py
│ ├── helper_types.py
│ ├── model_types.py
│ ├── palm_safety_types.py
│ ├── permission_types.py
│ ├── retriever_types.py
│ ├── safety_types.py
│ └── text_types.py
│ ├── utils.py
│ └── version.py
├── pyproject.toml
├── samples
├── README.md
├── cache.py
├── chat.py
├── code_execution.py
├── configure_model_parameters.py
├── controlled_generation.py
├── count_tokens.py
├── embed.py
├── files.py
├── function_calling.py
├── increment_tuning_data.json
├── models.py
├── rest
│ ├── README.md
│ ├── cache.sh
│ ├── chat.sh
│ ├── code_execution.sh
│ ├── configure_model_parameters.sh
│ ├── controlled_generation.sh
│ ├── count_tokens.sh
│ ├── embed.sh
│ ├── files.sh
│ ├── function_calling.sh
│ ├── models.sh
│ ├── safety_settings.sh
│ ├── system_instruction.sh
│ ├── text_generation.sh
│ └── tuned_models.sh
├── safety_settings.py
├── system_instruction.py
├── text_generation.py
└── tuned_models.py
├── setup.py
├── tests
├── __init__.py
├── notebook
│ ├── __init__.py
│ ├── lib
│ │ ├── __init__.py
│ │ ├── test_llm_function.py
│ │ ├── test_llmfn_output_row.py
│ │ ├── test_llmfn_outputs.py
│ │ ├── test_llmfn_post_process_cmds.py
│ │ ├── test_prompt_utils.py
│ │ └── unique_fn_test.py
│ ├── test_argument_parser.py
│ ├── test_cmd_line_parser.py
│ ├── test_flag_def.py
│ ├── test_html_utils.py
│ ├── test_magics_engine.py
│ ├── test_model_registry.py
│ ├── test_post_process_utils.py
│ ├── test_py_utils.py
│ ├── test_sheets_id.py
│ ├── test_sheets_sanitize_url.py
│ ├── tet_input_utils.py
│ └── text_model_test.py
├── test.csv
├── test1.json
├── test2.json
├── test3.json
├── test_answer.py
├── test_async_code_match.py
├── test_caching.py
├── test_client.py
├── test_content.py
├── test_embedding.py
├── test_embedding_async.py
├── test_files.py
├── test_generation.py
├── test_generative_models.py
├── test_generative_models_async.py
├── test_helpers.py
├── test_img.gif
├── test_img.jpg
├── test_img.png
├── test_models.py
├── test_operations.py
├── test_permission.py
├── test_permission_async.py
├── test_protos.py
├── test_responder.py
├── test_retriever.py
├── test_retriever_async.py
├── test_safety.py
├── test_string_utils.py
└── test_typing_extensions.py
└── third_party
├── Big_Buck_Bunny.mp4
├── Cajun_instruments.jpg
├── LICENSE.txt
├── a11.txt
├── organ.jpg
├── poem.txt
├── sample.mp3
└── test.pdf
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | # Unix-style newlines with a newline ending every file
4 | [*]
5 | end_of_line = lf
6 | insert_final_newline = true
7 |
8 | # 4 space indentation
9 | [*.py]
10 | charset = utf-8
11 | indent_style = space
12 | indent_size = 4
13 | max_line_length = 100
14 |
--------------------------------------------------------------------------------
/.github/labeler.yml:
--------------------------------------------------------------------------------
1 | 'status:awaiting review':
2 | - '**/*'
3 |
4 | 'component:python sdk':
5 | - '**/*'
6 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ## Description of the change
2 |
3 |
4 | ## Motivation
5 |
6 |
7 | ## Type of change
8 | Choose one: (Bug fix | Feature request | Documentation | Other)
9 |
10 | ## Checklist
11 |
12 | - [ ] I have performed a self-review of my code.
13 | - [ ] I have added detailed comments to my code where applicable.
14 | - [ ] I have verified that my change does not break existing code.
15 | - [ ] My PR is based on the latest changes of the main branch (if unsure, please run `git pull --rebase upstream main`).
16 | - [ ] I am familiar with the [Google Style Guide](https://google.github.io/styleguide/) for the language I have coded in.
17 | - [ ] I have read through the [Contributing Guide](https://github.com/google/generative-ai-python/blob/main/CONTRIBUTING.md) and signed the [Contributor License Agreement](https://cla.developers.google.com/about).
18 |
--------------------------------------------------------------------------------
/.github/workflows/labeler.yml:
--------------------------------------------------------------------------------
1 | name: "PR Labeler"
2 |
3 | on:
4 | pull_request_target:
5 | types: ["opened", "reopened", "ready_for_review"]
6 |
7 | jobs:
8 | triage:
9 | permissions:
10 | contents: read
11 | pull-requests: write
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions/labeler@v4
15 | if: ${{ github.event.pull_request.draft == false }}
16 |
--------------------------------------------------------------------------------
/.github/workflows/remove-issue-labels.yml:
--------------------------------------------------------------------------------
1 | name: Remove issue labels
2 |
3 | on:
4 | issues:
5 | types: [closed]
6 |
7 | jobs:
8 | remove_label:
9 | permissions:
10 | contents: read
11 | issues: write
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions-ecosystem/action-remove-labels@v1
15 | with:
16 | labels: |
17 | status:triaged
18 | status:more data needed
19 |
--------------------------------------------------------------------------------
/.github/workflows/remove-pr-labels.yml:
--------------------------------------------------------------------------------
1 | name: Remove PR Labels
2 |
3 | on:
4 | pull_request_target:
5 | types: ["closed", "merged"]
6 |
7 | jobs:
8 | remove_label:
9 | permissions:
10 | contents: read
11 | pull-requests: write
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions-ecosystem/action-remove-labels@v1
15 | with:
16 | labels: |
17 | status:awaiting review
18 | status:awaiting user response
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /venv/
2 | /.eggs/
3 | /.idea/
4 | /.pytype/
5 | /build/
6 | *.egg-info
7 | .DS_Store
8 | __pycache__
9 | *.iml
10 | /dist/
11 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @google/generative-ai-admin
2 |
--------------------------------------------------------------------------------
/RELEASE.md:
--------------------------------------------------------------------------------
1 | ## v0.2.2
2 |
3 | - Handle maximum batch size for `embed_text`.
4 | - Restore `types.ModelNameOptions`.
5 | - Update tuning to handle more dataset types (json, pandas, urls, google-sheets).
6 | - Expose `count_text_tokens`
7 | - Expose operations management.
8 | - Allow users to pass custom `metadata` (HTML headers).
9 | - Add dataclass prettyprinting.
10 |
11 | ## v0.2.1
12 |
13 | - Bugfix: Add missing enum names to `saftey_types.py`
14 | - Update to `google.ai.generativelanguage` v0.3.3
15 |
16 | ## v0.2
17 |
18 | - More flexible safety settings:
19 | - accept strings, ints for enums.
20 | - accept a `{category:threshold}` dict in addition to the
21 | list of dicts format (`[{"category": category, "threshold": threshold}, ...]`).
22 | - Add support for batched embeddings.
23 | - Add support for tuning:
24 | - Add `get_{base,tuned}_model`.
25 | - Add `list_tuned_models`.
26 | - Add `create_tuned_model`.
27 |
28 | ## v0.1
29 |
30 | Initial version
31 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/_redirects.yaml:
--------------------------------------------------------------------------------
1 | redirects:
2 | - from: /api/python/google/generativeai/GenerationConfig
3 | to: /api/python/google/generativeai/types/GenerationConfig
4 | - from: /api/python/google/generativeai/protos/ContentFilter/BlockedReason
5 | to: /api/python/google/generativeai/types/BlockedReason
6 | - from: /api/python/google/generativeai/protos/SafetyRating/HarmProbability
7 | to: /api/python/google/generativeai/types/HarmProbability
8 | - from: /api/python/google/generativeai/protos/SafetySetting/HarmBlockThreshold
9 | to: /api/python/google/generativeai/types/HarmBlockThreshold
10 | - from: /api/python/google/generativeai/protos/TunedModel/State
11 | to: /api/python/google/generativeai/types/TunedModelState
12 | - from: /api/python/google/generativeai/types/ModelNameOptions
13 | to: /api/python/google/generativeai/types/AnyModelNameOptions
14 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/api_report.pb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/docs/api/google/generativeai/api_report.pb
--------------------------------------------------------------------------------
/docs/api/google/generativeai/caching.md:
--------------------------------------------------------------------------------
1 |
2 | # Module: google.generativeai.caching
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | ## Classes
22 |
23 | [`class CachedContent`](../../google/generativeai/caching/CachedContent.md): Cached content resource.
24 |
25 | ## Functions
26 |
27 | [`get_default_cache_client(...)`](../../google/generativeai/caching/get_default_cache_client.md)
28 |
29 |
30 |
31 |
32 |
33 |
34 | Other Members |
35 |
36 |
37 |
38 |
39 | annotations
40 |
41 | |
42 |
43 |
44 | Instance of `__future__._Feature`
45 |
46 | |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/caching/get_default_cache_client.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.caching.get_default_cache_client
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | google.generativeai.caching.get_default_cache_client() -> glm.CacheServiceClient
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/delete_file.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.delete_file
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Calls the API to permanently delete a specified file using a supported file service.
18 |
19 |
20 |
21 | google.generativeai.delete_file(
22 | name: (str | file_types.File | protos.File)
23 | )
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/delete_tuned_model.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.delete_tuned_model
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Calls the API to delete a specified tuned model
18 |
19 |
20 |
21 | google.generativeai.delete_tuned_model(
22 | tuned_model: model_types.TunedModelNameOptions,
23 | client: (glm.ModelServiceClient | None) = None,
24 | request_options: (helper_types.RequestOptionsType | None) = None
25 | ) -> None
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/embed_content_async.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.embed_content_async
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Calls the API to create async embeddings for content passed in.
18 |
19 |
20 |
21 | google.generativeai.embed_content_async(
22 | model,
23 | content,
24 | task_type=None,
25 | title=None,
26 | output_dimensionality=None,
27 | client=None,
28 | request_options=None
29 | )
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/get_file.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.get_file
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Calls the API to retrieve a specified file using a supported file service.
18 |
19 |
20 |
21 | google.generativeai.get_file(
22 | name: str
23 | ) -> file_types.File
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/get_operation.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.get_operation
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Calls the API to get a specific operation
18 |
19 |
20 |
21 | google.generativeai.get_operation(
22 | name: str, *, client=None
23 | ) -> CreateTunedModelOperation
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/list_files.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.list_files
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Calls the API to list files using a supported file service.
18 |
19 |
20 |
21 | google.generativeai.list_files(
22 | page_size=100
23 | ) -> Iterable[file_types.File]
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/list_operations.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.list_operations
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Calls the API to list all operations
18 |
19 |
20 |
21 | google.generativeai.list_operations(
22 | *, client=None
23 | ) -> Iterator[CreateTunedModelOperation]
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/AttributionSourceId/GroundingPassageId.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.AttributionSourceId.GroundingPassageId
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Identifier for a part within a ``GroundingPassage``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `passage_id`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Output only. ID of the passage matching the
40 | ``GenerateAnswerRequest``'s GroundingPassage.id .
41 |
42 | |
43 |
44 |
45 |
46 | `part_index`
47 |
48 | |
49 |
50 |
51 | `int`
52 |
53 | Output only. Index of the part within the
54 | ``GenerateAnswerRequest``'s GroundingPassage.content .
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/AttributionSourceId/SemanticRetrieverChunk.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.AttributionSourceId.SemanticRetrieverChunk
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Identifier for a ``Chunk`` retrieved via Semantic Retriever specified in the ``GenerateAnswerRequest`` using ``SemanticRetrieverConfig``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `source`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Output only. Name of the source matching the request's
40 | SemanticRetrieverConfig.source . Example: ``corpora/123``
41 | or ``corpora/123/documents/abc``
42 |
43 | |
44 |
45 |
46 |
47 | `chunk`
48 |
49 | |
50 |
51 |
52 | `str`
53 |
54 | Output only. Name of the ``Chunk`` containing the attributed
55 | text. Example: ``corpora/123/documents/abc/chunks/xyz``
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/BatchCreateChunksRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.BatchCreateChunksRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to batch create ``Chunk``\ s.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `parent`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Optional. The name of the ``Document`` where this batch of
40 | ``Chunk``\ s will be created. The parent field in every
41 | ``CreateChunkRequest`` must match this value. Example:
42 | ``corpora/my-corpus-123/documents/the-doc-abc``
43 |
44 | |
45 |
46 |
47 |
48 | `requests`
49 |
50 | |
51 |
52 |
53 | `MutableSequence[google.ai.generativelanguage.CreateChunkRequest]`
54 |
55 | Required. The request messages specifying the ``Chunk``\ s
56 | to create. A maximum of 100 ``Chunk``\ s can be created in a
57 | batch.
58 |
59 | |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/BatchCreateChunksResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.BatchCreateChunksResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``BatchCreateChunks`` containing a list of created ``Chunk``\ s.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `chunks`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.Chunk]`
38 |
39 | ``Chunk``\ s created.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/BatchDeleteChunksRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.BatchDeleteChunksRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to batch delete ``Chunk``\ s.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `parent`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Optional. The name of the ``Document`` containing the
40 | ``Chunk``\ s to delete. The parent field in every
41 | ``DeleteChunkRequest`` must match this value. Example:
42 | ``corpora/my-corpus-123/documents/the-doc-abc``
43 |
44 | |
45 |
46 |
47 |
48 | `requests`
49 |
50 | |
51 |
52 |
53 | `MutableSequence[google.ai.generativelanguage.DeleteChunkRequest]`
54 |
55 | Required. The request messages specifying the ``Chunk``\ s
56 | to delete.
57 |
58 | |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/BatchEmbedContentsResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.BatchEmbedContentsResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | The response to a ``BatchEmbedContentsRequest``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `embeddings`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.ContentEmbedding]`
38 |
39 | Output only. The embeddings for each request,
40 | in the same order as provided in the batch
41 | request.
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/BatchEmbedTextResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.BatchEmbedTextResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | The response to a EmbedTextRequest.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `embeddings`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.Embedding]`
38 |
39 | Output only. The embeddings generated from
40 | the input text.
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/BatchUpdateChunksRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.BatchUpdateChunksRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to batch update ``Chunk``\ s.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `parent`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Optional. The name of the ``Document`` containing the
40 | ``Chunk``\ s to update. The parent field in every
41 | ``UpdateChunkRequest`` must match this value. Example:
42 | ``corpora/my-corpus-123/documents/the-doc-abc``
43 |
44 | |
45 |
46 |
47 |
48 | `requests`
49 |
50 | |
51 |
52 |
53 | `MutableSequence[google.ai.generativelanguage.UpdateChunkRequest]`
54 |
55 | Required. The request messages specifying the ``Chunk``\ s
56 | to update. A maximum of 100 ``Chunk``\ s can be updated in a
57 | batch.
58 |
59 | |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/BatchUpdateChunksResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.BatchUpdateChunksResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``BatchUpdateChunks`` containing a list of updated ``Chunk``\ s.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `chunks`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.Chunk]`
38 |
39 | ``Chunk``\ s updated.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/Blob.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.Blob
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Raw media bytes.
18 |
19 |
20 |
21 | Text should not be sent as raw bytes, use the 'text' field.
22 |
23 |
24 |
25 |
26 |
27 |
28 | Attributes |
29 |
30 |
31 |
32 |
33 | `mime_type`
34 |
35 | |
36 |
37 |
38 | `str`
39 |
40 | The IANA standard MIME type of the source data. Examples:
41 |
42 | - image/png
43 | - image/jpeg If an unsupported MIME type is provided, an
44 | error will be returned. For a complete list of supported
45 | types, see `Supported file
46 | formats `__.
47 |
48 | |
49 |
50 |
51 |
52 | `data`
53 |
54 | |
55 |
56 |
57 | `bytes`
58 |
59 | Raw bytes for media formats.
60 |
61 | |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CachedContent/UsageMetadata.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CachedContent.UsageMetadata
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Metadata on the usage of the cached content.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `total_token_count`
33 |
34 | |
35 |
36 |
37 | `int`
38 |
39 | Total number of tokens that the cached
40 | content consumes.
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ChunkData.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ChunkData
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Extracted data that represents the ``Chunk`` content.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `string_value`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | The ``Chunk`` content as a string. The maximum number of
40 | tokens per chunk is 2043.
41 |
42 | This field is a member of `oneof`_ ``data``.
43 |
44 | |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CitationMetadata.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CitationMetadata
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A collection of source attributions for a piece of content.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `citation_sources`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.CitationSource]`
38 |
39 | Citations to sources for a specific response.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CodeExecution.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CodeExecution
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Tool that executes code generated by the model, and automatically returns the result to the model.
18 |
19 |
20 |
21 | See also ``ExecutableCode`` and ``CodeExecutionResult`` which are
22 | only generated when using this tool.
23 |
24 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CodeExecutionResult.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CodeExecutionResult
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Result of executing the ``ExecutableCode``.
18 |
19 |
20 |
21 | Only generated when using the ``CodeExecution``, and always follows
22 | a ``part`` containing the ``ExecutableCode``.
23 |
24 |
25 |
26 |
27 |
28 |
29 | Attributes |
30 |
31 |
32 |
33 |
34 | `outcome`
35 |
36 | |
37 |
38 |
39 | `google.ai.generativelanguage.CodeExecutionResult.Outcome`
40 |
41 | Required. Outcome of the code execution.
42 |
43 | |
44 |
45 |
46 |
47 | `output`
48 |
49 | |
50 |
51 |
52 | `str`
53 |
54 | Optional. Contains stdout when code execution
55 | is successful, stderr or other description
56 | otherwise.
57 |
58 | |
59 |
60 |
61 |
62 |
63 |
64 | ## Child Classes
65 | [`class Outcome`](../../../google/generativeai/protos/CodeExecutionResult/Outcome.md)
66 |
67 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/Content.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.Content
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | The base structured datatype containing multi-part content of a message.
18 |
19 |
20 |
21 | A ``Content`` includes a ``role`` field designating the producer of
22 | the ``Content`` and a ``parts`` field containing multi-part data
23 | that contains the content of the message turn.
24 |
25 |
26 |
27 |
28 |
29 |
30 | Attributes |
31 |
32 |
33 |
34 |
35 | `parts`
36 |
37 | |
38 |
39 |
40 | `MutableSequence[google.ai.generativelanguage.Part]`
41 |
42 | Ordered ``Parts`` that constitute a single message. Parts
43 | may have different MIME types.
44 |
45 | |
46 |
47 |
48 |
49 | `role`
50 |
51 | |
52 |
53 |
54 | `str`
55 |
56 | Optional. The producer of the content. Must
57 | be either 'user' or 'model'.
58 | Useful to set for multi-turn conversations,
59 | otherwise can be left blank or unset.
60 |
61 | |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ContentEmbedding.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ContentEmbedding
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A list of floats representing an embedding.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `values`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[float]`
38 |
39 | The embedding values.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ContentFilter.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ContentFilter
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Content filtering metadata associated with processing a single request.
18 |
19 |
20 | ContentFilter contains a reason and an optional supporting
21 | string. The reason may be unspecified.
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | Attributes |
31 |
32 |
33 |
34 |
35 | `reason`
36 |
37 | |
38 |
39 |
40 | `google.ai.generativelanguage.ContentFilter.BlockedReason`
41 |
42 | The reason content was blocked during request
43 | processing.
44 |
45 | |
46 |
47 |
48 |
49 | `message`
50 |
51 | |
52 |
53 |
54 | `str`
55 |
56 | A string that describes the filtering
57 | behavior in more detail.
58 |
59 |
60 | |
61 |
62 |
63 |
64 |
65 |
66 | ## Child Classes
67 | [`class BlockedReason`](../../../google/generativeai/types/BlockedReason.md)
68 |
69 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CountMessageTokensRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CountMessageTokensRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Counts the number of tokens in the ``prompt`` sent to a model.
18 |
19 |
20 |
21 | Models may tokenize text differently, so each model may return a
22 | different ``token_count``.
23 |
24 |
25 |
26 |
27 |
28 |
29 | Attributes |
30 |
31 |
32 |
33 |
34 | `model`
35 |
36 | |
37 |
38 |
39 | `str`
40 |
41 | Required. The model's resource name. This serves as an ID
42 | for the Model to use.
43 |
44 | This name should match a model name returned by the
45 | ``ListModels`` method.
46 |
47 | Format: ``models/{model}``
48 |
49 | |
50 |
51 |
52 |
53 | `prompt`
54 |
55 | |
56 |
57 |
58 | `google.ai.generativelanguage.MessagePrompt`
59 |
60 | Required. The prompt, whose token count is to
61 | be returned.
62 |
63 | |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CountMessageTokensResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CountMessageTokensResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A response from ``CountMessageTokens``.
18 |
19 |
20 |
21 | It returns the model's ``token_count`` for the ``prompt``.
22 |
23 |
24 |
25 |
26 |
27 |
28 | Attributes |
29 |
30 |
31 |
32 |
33 | `token_count`
34 |
35 | |
36 |
37 |
38 | `int`
39 |
40 | The number of tokens that the ``model`` tokenizes the
41 | ``prompt`` into.
42 |
43 | Always non-negative.
44 |
45 | |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CountTextTokensRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CountTextTokensRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Counts the number of tokens in the ``prompt`` sent to a model.
18 |
19 |
20 |
21 | Models may tokenize text differently, so each model may return a
22 | different ``token_count``.
23 |
24 |
25 |
26 |
27 |
28 |
29 | Attributes |
30 |
31 |
32 |
33 |
34 | `model`
35 |
36 | |
37 |
38 |
39 | `str`
40 |
41 | Required. The model's resource name. This serves as an ID
42 | for the Model to use.
43 |
44 | This name should match a model name returned by the
45 | ``ListModels`` method.
46 |
47 | Format: ``models/{model}``
48 |
49 | |
50 |
51 |
52 |
53 | `prompt`
54 |
55 | |
56 |
57 |
58 | `google.ai.generativelanguage.TextPrompt`
59 |
60 | Required. The free-form input text given to
61 | the model as a prompt.
62 |
63 | |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CountTextTokensResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CountTextTokensResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A response from ``CountTextTokens``.
18 |
19 |
20 |
21 | It returns the model's ``token_count`` for the ``prompt``.
22 |
23 |
24 |
25 |
26 |
27 |
28 | Attributes |
29 |
30 |
31 |
32 |
33 | `token_count`
34 |
35 | |
36 |
37 |
38 | `int`
39 |
40 | The number of tokens that the ``model`` tokenizes the
41 | ``prompt`` into.
42 |
43 | Always non-negative.
44 |
45 | |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CountTokensResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CountTokensResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A response from ``CountTokens``.
18 |
19 |
20 |
21 | It returns the model's ``token_count`` for the ``prompt``.
22 |
23 |
24 |
25 |
26 |
27 |
28 | Attributes |
29 |
30 |
31 |
32 |
33 | `total_tokens`
34 |
35 | |
36 |
37 |
38 | `int`
39 |
40 | The number of tokens that the ``Model`` tokenizes the
41 | ``prompt`` into. Always non-negative.
42 |
43 | |
44 |
45 |
46 |
47 | `cached_content_token_count`
48 |
49 | |
50 |
51 |
52 | `int`
53 |
54 | Number of tokens in the cached part of the
55 | prompt (the cached content).
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CreateCachedContentRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CreateCachedContentRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to create CachedContent.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `cached_content`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.CachedContent`
38 |
39 | Required. The cached content to create.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CreateChunkRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CreateChunkRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to create a ``Chunk``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `parent`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The name of the ``Document`` where this ``Chunk``
40 | will be created. Example:
41 | ``corpora/my-corpus-123/documents/the-doc-abc``
42 |
43 | |
44 |
45 |
46 |
47 | `chunk`
48 |
49 | |
50 |
51 |
52 | `google.ai.generativelanguage.Chunk`
53 |
54 | Required. The ``Chunk`` to create.
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CreateCorpusRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CreateCorpusRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to create a ``Corpus``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `corpus`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.Corpus`
38 |
39 | Required. The ``Corpus`` to create.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CreateDocumentRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CreateDocumentRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to create a ``Document``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `parent`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The name of the ``Corpus`` where this ``Document``
40 | will be created. Example: ``corpora/my-corpus-123``
41 |
42 | |
43 |
44 |
45 |
46 | `document`
47 |
48 | |
49 |
50 |
51 | `google.ai.generativelanguage.Document`
52 |
53 | Required. The ``Document`` to create.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CreateFileRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CreateFileRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for ``CreateFile``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `file`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.File`
38 |
39 | Optional. Metadata for the file to create.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CreateFileResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CreateFileResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response for ``CreateFile``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `file`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.File`
38 |
39 | Metadata for the created file.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CreatePermissionRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CreatePermissionRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to create a ``Permission``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `parent`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The parent resource of the ``Permission``.
40 | Formats: ``tunedModels/{tuned_model}`` ``corpora/{corpus}``
41 |
42 | |
43 |
44 |
45 |
46 | `permission`
47 |
48 | |
49 |
50 |
51 | `google.ai.generativelanguage.Permission`
52 |
53 | Required. The permission to create.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/CreateTunedModelRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.CreateTunedModelRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to create a TunedModel.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `tuned_model_id`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Optional. The unique id for the tuned model if specified.
40 | This value should be up to 40 characters, the first
41 | character must be a letter, the last could be a letter or a
42 | number. The id must match the regular expression:
43 | ``[a-z]([a-z0-9-]{0,38}[a-z0-9])?``.
44 |
45 |
46 | |
47 |
48 |
49 |
50 | `tuned_model`
51 |
52 | |
53 |
54 |
55 | `google.ai.generativelanguage.TunedModel`
56 |
57 | Required. The tuned model to create.
58 |
59 | |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/Dataset.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.Dataset
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Dataset for training or validation.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `examples`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.TuningExamples`
38 |
39 | Optional. Inline examples.
40 |
41 | This field is a member of `oneof`_ ``dataset``.
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/DeleteCachedContentRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.DeleteCachedContentRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to delete CachedContent.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name referring to the content cache
40 | entry Format: ``cachedContents/{id}``
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/DeleteChunkRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.DeleteChunkRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to delete a ``Chunk``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the ``Chunk`` to delete.
40 | Example:
41 | ``corpora/my-corpus-123/documents/the-doc-abc/chunks/some-chunk``
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/DeleteCorpusRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.DeleteCorpusRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to delete a ``Corpus``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the ``Corpus``. Example:
40 | ``corpora/my-corpus-123``
41 |
42 | |
43 |
44 |
45 |
46 | `force`
47 |
48 | |
49 |
50 |
51 | `bool`
52 |
53 | Optional. If set to true, any ``Document``\ s and objects
54 | related to this ``Corpus`` will also be deleted.
55 |
56 | If false (the default), a ``FAILED_PRECONDITION`` error will
57 | be returned if ``Corpus`` contains any ``Document``\ s.
58 |
59 | |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/DeleteDocumentRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.DeleteDocumentRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to delete a ``Document``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the ``Document`` to delete.
40 | Example: ``corpora/my-corpus-123/documents/the-doc-abc``
41 |
42 | |
43 |
44 |
45 |
46 | `force`
47 |
48 | |
49 |
50 |
51 | `bool`
52 |
53 | Optional. If set to true, any ``Chunk``\ s and objects
54 | related to this ``Document`` will also be deleted.
55 |
56 | If false (the default), a ``FAILED_PRECONDITION`` error will
57 | be returned if ``Document`` contains any ``Chunk``\ s.
58 |
59 | |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/DeleteFileRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.DeleteFileRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for ``DeleteFile``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The name of the ``File`` to delete. Example:
40 | ``files/abc-123``
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/DeletePermissionRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.DeletePermissionRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to delete the ``Permission``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the permission. Formats:
40 | ``tunedModels/{tuned_model}/permissions/{permission}``
41 | ``corpora/{corpus}/permissions/{permission}``
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/DeleteTunedModelRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.DeleteTunedModelRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to delete a TunedModel.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the model. Format:
40 | ``tunedModels/my-model-id``
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/DynamicRetrievalConfig.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.DynamicRetrievalConfig
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Describes the options to customize dynamic retrieval.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `mode`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.DynamicRetrievalConfig.Mode`
38 |
39 | The mode of the predictor to be used in
40 | dynamic retrieval.
41 |
42 | |
43 |
44 |
45 |
46 | `dynamic_threshold`
47 |
48 | |
49 |
50 |
51 | `float`
52 |
53 | The threshold to be used in dynamic
54 | retrieval. If not set, a system default value is
55 | used.
56 |
57 |
58 | |
59 |
60 |
61 |
62 |
63 |
64 | ## Child Classes
65 | [`class Mode`](../../../google/generativeai/protos/DynamicRetrievalConfig/Mode.md)
66 |
67 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/EmbedContentResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.EmbedContentResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | The response to an ``EmbedContentRequest``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `embedding`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.ContentEmbedding`
38 |
39 | Output only. The embedding generated from the
40 | input content.
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/EmbedTextRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.EmbedTextRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to get a text embedding from the model.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `model`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The model name to use with the
40 | format model=models/{model}.
41 |
42 | |
43 |
44 |
45 |
46 | `text`
47 |
48 | |
49 |
50 |
51 | `str`
52 |
53 | Optional. The free-form input text that the
54 | model will turn into an embedding.
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/EmbedTextResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.EmbedTextResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | The response to a EmbedTextRequest.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `embedding`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.Embedding`
38 |
39 | Output only. The embedding generated from the
40 | input text.
41 |
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/Embedding.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.Embedding
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A list of floats representing the embedding.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `value`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[float]`
38 |
39 | The embedding values.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/Example.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.Example
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | An input/output example used to instruct the Model.
18 |
19 |
20 |
21 | It demonstrates how the model should respond or format its
22 | response.
23 |
24 |
25 |
26 |
27 |
28 |
29 | Attributes |
30 |
31 |
32 |
33 |
34 | `input`
35 |
36 | |
37 |
38 |
39 | `google.ai.generativelanguage.Message`
40 |
41 | Required. An example of an input ``Message`` from the user.
42 |
43 | |
44 |
45 |
46 |
47 | `output`
48 |
49 | |
50 |
51 |
52 | `google.ai.generativelanguage.Message`
53 |
54 | Required. An example of what the model should
55 | output given the input.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ExecutableCode.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ExecutableCode
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Code generated by the model that is meant to be executed, and the result returned to the model.
18 |
19 |
20 |
21 | Only generated when using the ``CodeExecution`` tool, in which the
22 | code will be automatically executed, and a corresponding
23 | ``CodeExecutionResult`` will also be generated.
24 |
25 |
26 |
27 |
28 |
29 |
30 | Attributes |
31 |
32 |
33 |
34 |
35 | `language`
36 |
37 | |
38 |
39 |
40 | `google.ai.generativelanguage.ExecutableCode.Language`
41 |
42 | Required. Programming language of the ``code``.
43 |
44 | |
45 |
46 |
47 |
48 | `code`
49 |
50 | |
51 |
52 |
53 | `str`
54 |
55 | Required. The code to be executed.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 | ## Child Classes
64 | [`class Language`](../../../google/generativeai/protos/ExecutableCode/Language.md)
65 |
66 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/FileData.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.FileData
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | URI based data.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `mime_type`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Optional. The IANA standard MIME type of the
40 | source data.
41 |
42 | |
43 |
44 |
45 |
46 | `file_uri`
47 |
48 | |
49 |
50 |
51 | `str`
52 |
53 | Required. URI.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/FunctionCall.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.FunctionCall
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A predicted ``FunctionCall`` returned from the model that contains a string representing the FunctionDeclaration.name
with the arguments and their values.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | Attributes |
29 |
30 |
31 |
32 |
33 | `name`
34 |
35 | |
36 |
37 |
38 | `str`
39 |
40 | Required. The name of the function to call.
41 | Must be a-z, A-Z, 0-9, or contain underscores
42 | and dashes, with a maximum length of 63.
43 |
44 | |
45 |
46 |
47 |
48 | `args`
49 |
50 | |
51 |
52 |
53 | `google.protobuf.struct_pb2.Struct`
54 |
55 | Optional. The function parameters and values
56 | in JSON object format.
57 |
58 |
59 | |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GetCachedContentRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GetCachedContentRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to read CachedContent.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name referring to the content cache
40 | entry. Format: ``cachedContents/{id}``
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GetChunkRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GetChunkRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for getting information about a specific ``Chunk``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The name of the ``Chunk`` to retrieve. Example:
40 | ``corpora/my-corpus-123/documents/the-doc-abc/chunks/some-chunk``
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GetCorpusRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GetCorpusRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for getting information about a specific ``Corpus``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The name of the ``Corpus``. Example:
40 | ``corpora/my-corpus-123``
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GetDocumentRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GetDocumentRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for getting information about a specific ``Document``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The name of the ``Document`` to retrieve. Example:
40 | ``corpora/my-corpus-123/documents/the-doc-abc``
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GetFileRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GetFileRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for ``GetFile``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The name of the ``File`` to get. Example:
40 | ``files/abc-123``
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GetModelRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GetModelRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for getting information about a specific Model.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the model.
40 |
41 | This name should match a model name returned by the
42 | ``ListModels`` method.
43 |
44 | Format: ``models/{model}``
45 |
46 | |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GetPermissionRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GetPermissionRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for getting information about a specific ``Permission``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the permission.
40 |
41 | Formats:
42 | ``tunedModels/{tuned_model}/permissions/{permission}``
43 | ``corpora/{corpus}/permissions/{permission}``
44 |
45 | |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GetTunedModelRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GetTunedModelRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for getting information about a specific Model.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the model.
40 |
41 | Format: ``tunedModels/my-model-id``
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GoogleSearchRetrieval.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GoogleSearchRetrieval
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Tool to retrieve public web data for grounding, powered by Google.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `dynamic_retrieval_config`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.DynamicRetrievalConfig`
38 |
39 | Specifies the dynamic retrieval configuration
40 | for the given source.
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GroundingAttribution.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GroundingAttribution
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Attribution for a source that contributed to an answer.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `source_id`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.AttributionSourceId`
38 |
39 | Output only. Identifier for the source
40 | contributing to this attribution.
41 |
42 | |
43 |
44 |
45 |
46 | `content`
47 |
48 | |
49 |
50 |
51 | `google.ai.generativelanguage.Content`
52 |
53 | Grounding source content that makes up this
54 | attribution.
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GroundingChunk.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GroundingChunk
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Grounding chunk.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `web`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.GroundingChunk.Web`
38 |
39 | Grounding chunk from the web.
40 |
41 | This field is a member of `oneof`_ ``chunk_type``.
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 | ## Child Classes
50 | [`class Web`](../../../google/generativeai/protos/GroundingChunk/Web.md)
51 |
52 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GroundingChunk/Web.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GroundingChunk.Web
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Chunk from the web.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `uri`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | URI reference of the chunk.
40 |
41 |
42 | |
43 |
44 |
45 |
46 | `title`
47 |
48 | |
49 |
50 |
51 | `str`
52 |
53 | Title of the chunk.
54 |
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GroundingPassage.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GroundingPassage
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Passage included inline with a grounding configuration.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `id`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Identifier for the passage for attributing
40 | this passage in grounded answers.
41 |
42 | |
43 |
44 |
45 |
46 | `content`
47 |
48 | |
49 |
50 |
51 | `google.ai.generativelanguage.Content`
52 |
53 | Content of the passage.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/GroundingPassages.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.GroundingPassages
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A repeated list of passages.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `passages`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.GroundingPassage]`
38 |
39 | List of passages.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListCachedContentsResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListCachedContentsResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response with CachedContents list.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `cached_contents`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.CachedContent]`
38 |
39 | List of cached contents.
40 |
41 | |
42 |
43 |
44 |
45 | `next_page_token`
46 |
47 | |
48 |
49 |
50 | `str`
51 |
52 | A token, which can be sent as ``page_token`` to retrieve the
53 | next page. If this field is omitted, there are no subsequent
54 | pages.
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListChunksResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListChunksResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``ListChunks`` containing a paginated list of ``Chunk``\ s.
18 |
19 |
20 | The ``Chunk``\ s are sorted by ascending
21 | ``chunk.create_time``.
22 |
23 |
24 |
25 |
26 |
27 |
28 | Attributes |
29 |
30 |
31 |
32 |
33 | `chunks`
34 |
35 | |
36 |
37 |
38 | `MutableSequence[google.ai.generativelanguage.Chunk]`
39 |
40 | The returned ``Chunk``\ s.
41 |
42 | |
43 |
44 |
45 |
46 | `next_page_token`
47 |
48 | |
49 |
50 |
51 | `str`
52 |
53 | A token, which can be sent as ``page_token`` to retrieve the
54 | next page. If this field is omitted, there are no more
55 | pages.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListCorporaResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListCorporaResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``ListCorpora`` containing a paginated list of ``Corpora``.
18 |
19 |
20 | The results are sorted by ascending
21 | ``corpus.create_time``.
22 |
23 |
24 |
25 |
26 |
27 |
28 | Attributes |
29 |
30 |
31 |
32 |
33 | `corpora`
34 |
35 | |
36 |
37 |
38 | `MutableSequence[google.ai.generativelanguage.Corpus]`
39 |
40 | The returned corpora.
41 |
42 | |
43 |
44 |
45 |
46 | `next_page_token`
47 |
48 | |
49 |
50 |
51 | `str`
52 |
53 | A token, which can be sent as ``page_token`` to retrieve the
54 | next page. If this field is omitted, there are no more
55 | pages.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListDocumentsResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListDocumentsResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``ListDocuments`` containing a paginated list of ``Document``\ s.
18 |
19 |
20 | The ``Document``\ s are sorted by ascending
21 | ``document.create_time``.
22 |
23 |
24 |
25 |
26 |
27 |
28 | Attributes |
29 |
30 |
31 |
32 |
33 | `documents`
34 |
35 | |
36 |
37 |
38 | `MutableSequence[google.ai.generativelanguage.Document]`
39 |
40 | The returned ``Document``\ s.
41 |
42 | |
43 |
44 |
45 |
46 | `next_page_token`
47 |
48 | |
49 |
50 |
51 | `str`
52 |
53 | A token, which can be sent as ``page_token`` to retrieve the
54 | next page. If this field is omitted, there are no more
55 | pages.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListFilesRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListFilesRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for ``ListFiles``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `page_size`
33 |
34 | |
35 |
36 |
37 | `int`
38 |
39 | Optional. Maximum number of ``File``\ s to return per page.
40 | If unspecified, defaults to 10. Maximum ``page_size`` is
41 | 100.
42 |
43 | |
44 |
45 |
46 |
47 | `page_token`
48 |
49 | |
50 |
51 |
52 | `str`
53 |
54 | Optional. A page token from a previous ``ListFiles`` call.
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListFilesResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListFilesResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response for ``ListFiles``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `files`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.File]`
38 |
39 | The list of ``File``\ s.
40 |
41 | |
42 |
43 |
44 |
45 | `next_page_token`
46 |
47 | |
48 |
49 |
50 | `str`
51 |
52 | A token that can be sent as a ``page_token`` into a
53 | subsequent ``ListFiles`` call.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListModelsRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListModelsRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request for listing all Models.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `page_size`
33 |
34 | |
35 |
36 |
37 | `int`
38 |
39 | The maximum number of ``Models`` to return (per page).
40 |
41 | If unspecified, 50 models will be returned per page. This
42 | method returns at most 1000 models per page, even if you
43 | pass a larger page_size.
44 |
45 | |
46 |
47 |
48 |
49 | `page_token`
50 |
51 | |
52 |
53 |
54 | `str`
55 |
56 | A page token, received from a previous ``ListModels`` call.
57 |
58 | Provide the ``page_token`` returned by one request as an
59 | argument to the next request to retrieve the next page.
60 |
61 | When paginating, all other parameters provided to
62 | ``ListModels`` must match the call that provided the page
63 | token.
64 |
65 | |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListModelsResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListModelsResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``ListModel`` containing a paginated list of Models.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `models`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.Model]`
38 |
39 | The returned Models.
40 |
41 | |
42 |
43 |
44 |
45 | `next_page_token`
46 |
47 | |
48 |
49 |
50 | `str`
51 |
52 | A token, which can be sent as ``page_token`` to retrieve the
53 | next page.
54 |
55 | If this field is omitted, there are no more pages.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListPermissionsResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListPermissionsResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``ListPermissions`` containing a paginated list of permissions.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `permissions`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.Permission]`
38 |
39 | Returned permissions.
40 |
41 | |
42 |
43 |
44 |
45 | `next_page_token`
46 |
47 | |
48 |
49 |
50 | `str`
51 |
52 | A token, which can be sent as ``page_token`` to retrieve the
53 | next page.
54 |
55 | If this field is omitted, there are no more pages.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ListTunedModelsResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ListTunedModelsResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``ListTunedModels`` containing a paginated list of Models.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `tuned_models`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.TunedModel]`
38 |
39 | The returned Models.
40 |
41 | |
42 |
43 |
44 |
45 | `next_page_token`
46 |
47 | |
48 |
49 |
50 | `str`
51 |
52 | A token, which can be sent as ``page_token`` to retrieve the
53 | next page.
54 |
55 | If this field is omitted, there are no more pages.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/LogprobsResult.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.LogprobsResult
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Logprobs Result
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `top_candidates`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.LogprobsResult.TopCandidates]`
38 |
39 | Length = total number of decoding steps.
40 |
41 | |
42 |
43 |
44 |
45 | `chosen_candidates`
46 |
47 | |
48 |
49 |
50 | `MutableSequence[google.ai.generativelanguage.LogprobsResult.Candidate]`
51 |
52 | Length = total number of decoding steps. The chosen
53 | candidates may or may not be in top_candidates.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 | ## Child Classes
62 | [`class Candidate`](../../../google/generativeai/protos/LogprobsResult/Candidate.md)
63 |
64 | [`class TopCandidates`](../../../google/generativeai/protos/LogprobsResult/TopCandidates.md)
65 |
66 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/LogprobsResult/Candidate.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.LogprobsResult.Candidate
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Candidate for the logprobs token and score.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `token`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | The candidate’s token string value.
40 |
41 |
42 | |
43 |
44 |
45 |
46 | `token_id`
47 |
48 | |
49 |
50 |
51 | `int`
52 |
53 | The candidate’s token id value.
54 |
55 |
56 | |
57 |
58 |
59 |
60 | `log_probability`
61 |
62 | |
63 |
64 |
65 | `float`
66 |
67 | The candidate's log probability.
68 |
69 |
70 | |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/LogprobsResult/TopCandidates.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.LogprobsResult.TopCandidates
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Candidates with top log probabilities at each decoding step.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `candidates`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.LogprobsResult.Candidate]`
38 |
39 | Sorted by log probability in descending
40 | order.
41 |
42 | |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/MetadataFilter.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.MetadataFilter
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | User provided filter to limit retrieval based on ``Chunk`` or ``Document`` level metadata values.
18 |
19 |
20 | Example (genre = drama OR genre
21 | = action): key = "document.custom_metadata.genre" conditions =
22 | [{string_value = "drama", operation = EQUAL}, {string_value =
23 | "action", operation = EQUAL}]
24 |
25 |
26 |
27 |
28 |
29 |
30 | Attributes |
31 |
32 |
33 |
34 |
35 | `key`
36 |
37 | |
38 |
39 |
40 | `str`
41 |
42 | Required. The key of the metadata to filter
43 | on.
44 |
45 | |
46 |
47 |
48 |
49 | `conditions`
50 |
51 | |
52 |
53 |
54 | `MutableSequence[google.ai.generativelanguage.Condition]`
55 |
56 | Required. The ``Condition``\ s for the given key that will
57 | trigger this filter. Multiple ``Condition``\ s are joined by
58 | logical ORs.
59 |
60 | |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/PredictRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.PredictRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request message for [PredictionService.Predict][google.ai.generativelanguage.v1beta.PredictionService.Predict].
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `model`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The name of the model for prediction. Format:
40 | ``name=models/{model}``.
41 |
42 | |
43 |
44 |
45 |
46 | `instances`
47 |
48 | |
49 |
50 |
51 | `MutableSequence[google.protobuf.struct_pb2.Value]`
52 |
53 | Required. The instances that are the input to
54 | the prediction call.
55 |
56 | |
57 |
58 |
59 |
60 | `parameters`
61 |
62 | |
63 |
64 |
65 | `google.protobuf.struct_pb2.Value`
66 |
67 | Optional. The parameters that govern the
68 | prediction call.
69 |
70 | |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/PredictResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.PredictResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response message for [PredictionService.Predict].
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `predictions`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.protobuf.struct_pb2.Value]`
38 |
39 | The outputs of the prediction call.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/QueryCorpusResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.QueryCorpusResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``QueryCorpus`` containing a list of relevant chunks.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `relevant_chunks`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.RelevantChunk]`
38 |
39 | The relevant chunks.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/QueryDocumentResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.QueryDocumentResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``QueryDocument`` containing a list of relevant chunks.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `relevant_chunks`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.RelevantChunk]`
38 |
39 | The returned relevant chunks.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/RelevantChunk.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.RelevantChunk
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | The information for a chunk relevant to a query.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `chunk_relevance_score`
33 |
34 | |
35 |
36 |
37 | `float`
38 |
39 | ``Chunk`` relevance to the query.
40 |
41 | |
42 |
43 |
44 |
45 | `chunk`
46 |
47 | |
48 |
49 |
50 | `google.ai.generativelanguage.Chunk`
51 |
52 | ``Chunk`` associated with the query.
53 |
54 | |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/RetrievalMetadata.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.RetrievalMetadata
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Metadata related to retrieval in the grounding flow.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `google_search_dynamic_retrieval_score`
33 |
34 | |
35 |
36 |
37 | `float`
38 |
39 | Optional. Score indicating how likely information from
40 | google search could help answer the prompt. The score is in
41 | the range [0, 1], where 0 is the least likely and 1 is the
42 | most likely. This score is only populated when google search
43 | grounding and dynamic retrieval is enabled. It will be
44 | compared to the threshold to determine whether to trigger
45 | google search.
46 |
47 | |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/SafetyFeedback.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.SafetyFeedback
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Safety feedback for an entire request.
18 |
19 |
20 |
21 | This field is populated if content in the input and/or response
22 | is blocked due to safety settings. SafetyFeedback may not exist
23 | for every HarmCategory. Each SafetyFeedback will return the
24 | safety settings used by the request as well as the lowest
25 | HarmProbability that should be allowed in order to return a
26 | result.
27 |
28 |
29 |
30 |
31 |
32 |
33 | Attributes |
34 |
35 |
36 |
37 |
38 | `rating`
39 |
40 | |
41 |
42 |
43 | `google.ai.generativelanguage.SafetyRating`
44 |
45 | Safety rating evaluated from content.
46 |
47 | |
48 |
49 |
50 |
51 | `setting`
52 |
53 | |
54 |
55 |
56 | `google.ai.generativelanguage.SafetySetting`
57 |
58 | Safety settings applied to the request.
59 |
60 | |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/SafetySetting.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.SafetySetting
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Safety setting, affecting the safety-blocking behavior.
18 |
19 |
20 |
21 | Passing a safety setting for a category changes the allowed
22 | probability that content is blocked.
23 |
24 |
25 |
26 |
27 |
28 |
29 | Attributes |
30 |
31 |
32 |
33 |
34 | `category`
35 |
36 | |
37 |
38 |
39 | `google.ai.generativelanguage.HarmCategory`
40 |
41 | Required. The category for this setting.
42 |
43 | |
44 |
45 |
46 |
47 | `threshold`
48 |
49 | |
50 |
51 |
52 | `google.ai.generativelanguage.SafetySetting.HarmBlockThreshold`
53 |
54 | Required. Controls the probability threshold
55 | at which harm is blocked.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 | ## Child Classes
64 | [`class HarmBlockThreshold`](../../../google/generativeai/types/HarmBlockThreshold.md)
65 |
66 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/SearchEntryPoint.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.SearchEntryPoint
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Google search entry point.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `rendered_content`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Optional. Web content snippet that can be
40 | embedded in a web page or an app webview.
41 |
42 | |
43 |
44 |
45 |
46 | `sdk_blob`
47 |
48 | |
49 |
50 |
51 | `bytes`
52 |
53 | Optional. Base64 encoded JSON representing
54 | array of tuple.
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/StringList.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.StringList
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | User provided string values assigned to a single metadata key.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `values`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[str]`
38 |
39 | The string values of the metadata to store.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/TextPrompt.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.TextPrompt
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Text given to the model as a prompt.
18 |
19 |
20 |
21 | The Model will use this TextPrompt to Generate a text
22 | completion.
23 |
24 |
25 |
26 |
27 |
28 |
29 | Attributes |
30 |
31 |
32 |
33 |
34 | `text`
35 |
36 | |
37 |
38 |
39 | `str`
40 |
41 | Required. The prompt text.
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/ToolConfig.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.ToolConfig
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | The Tool configuration containing parameters for specifying ``Tool`` use in the request.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `function_calling_config`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.FunctionCallingConfig`
38 |
39 | Optional. Function calling config.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/TransferOwnershipRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.TransferOwnershipRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to transfer the ownership of the tuned model.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `name`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Required. The resource name of the tuned model to transfer
40 | ownership.
41 |
42 | Format: ``tunedModels/my-model-id``
43 |
44 | |
45 |
46 |
47 |
48 | `email_address`
49 |
50 | |
51 |
52 |
53 | `str`
54 |
55 | Required. The email address of the user to
56 | whom the tuned model is being transferred to.
57 |
58 | |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/TransferOwnershipResponse.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.TransferOwnershipResponse
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Response from ``TransferOwnership``.
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/TunedModelSource.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.TunedModelSource
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Tuned model as a source for training a new model.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `tuned_model`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Immutable. The name of the ``TunedModel`` to use as the
40 | starting point for training the new model. Example:
41 | ``tunedModels/my-tuned-model``
42 |
43 | |
44 |
45 |
46 |
47 | `base_model`
48 |
49 | |
50 |
51 |
52 | `str`
53 |
54 | Output only. The name of the base ``Model`` this
55 | ``TunedModel`` was tuned from. Example:
56 | ``models/gemini-1.5-flash-001``
57 |
58 | |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/TuningExample.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.TuningExample
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A single example for tuning.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `text_input`
33 |
34 | |
35 |
36 |
37 | `str`
38 |
39 | Optional. Text model input.
40 |
41 | This field is a member of `oneof`_ ``model_input``.
42 |
43 | |
44 |
45 |
46 |
47 | `output`
48 |
49 | |
50 |
51 |
52 | `str`
53 |
54 | Required. The expected model output.
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/TuningExamples.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.TuningExamples
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A set of tuning examples. Can be training or validation data.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `examples`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.TuningExample]`
38 |
39 | Required. The examples. Example input can be
40 | for text or discuss, but all examples in a set
41 | must be of the same type.
42 |
43 | |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/TuningSnapshot.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.TuningSnapshot
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Record for a single tuning step.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `step`
33 |
34 | |
35 |
36 |
37 | `int`
38 |
39 | Output only. The tuning step.
40 |
41 | |
42 |
43 |
44 |
45 | `epoch`
46 |
47 | |
48 |
49 |
50 | `int`
51 |
52 | Output only. The epoch this step was part of.
53 |
54 | |
55 |
56 |
57 |
58 | `mean_loss`
59 |
60 | |
61 |
62 |
63 | `float`
64 |
65 | Output only. The mean loss of the training
66 | examples for this step.
67 |
68 | |
69 |
70 |
71 |
72 | `compute_time`
73 |
74 | |
75 |
76 |
77 | `google.protobuf.timestamp_pb2.Timestamp`
78 |
79 | Output only. The timestamp when this metric
80 | was computed.
81 |
82 | |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/UpdateCachedContentRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.UpdateCachedContentRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to update CachedContent.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `cached_content`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.CachedContent`
38 |
39 | Required. The content cache entry to update
40 |
41 | |
42 |
43 |
44 |
45 | `update_mask`
46 |
47 | |
48 |
49 |
50 | `google.protobuf.field_mask_pb2.FieldMask`
51 |
52 | The list of fields to update.
53 |
54 | |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/UpdateChunkRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.UpdateChunkRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to update a ``Chunk``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `chunk`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.Chunk`
38 |
39 | Required. The ``Chunk`` to update.
40 |
41 | |
42 |
43 |
44 |
45 | `update_mask`
46 |
47 | |
48 |
49 |
50 | `google.protobuf.field_mask_pb2.FieldMask`
51 |
52 | Required. The list of fields to update. Currently, this only
53 | supports updating ``custom_metadata`` and ``data``.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/UpdateCorpusRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.UpdateCorpusRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to update a ``Corpus``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `corpus`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.Corpus`
38 |
39 | Required. The ``Corpus`` to update.
40 |
41 | |
42 |
43 |
44 |
45 | `update_mask`
46 |
47 | |
48 |
49 |
50 | `google.protobuf.field_mask_pb2.FieldMask`
51 |
52 | Required. The list of fields to update. Currently, this only
53 | supports updating ``display_name``.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/UpdateDocumentRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.UpdateDocumentRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to update a ``Document``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `document`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.Document`
38 |
39 | Required. The ``Document`` to update.
40 |
41 | |
42 |
43 |
44 |
45 | `update_mask`
46 |
47 | |
48 |
49 |
50 | `google.protobuf.field_mask_pb2.FieldMask`
51 |
52 | Required. The list of fields to update. Currently, this only
53 | supports updating ``display_name`` and ``custom_metadata``.
54 |
55 | |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/UpdatePermissionRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.UpdatePermissionRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to update the ``Permission``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `permission`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.Permission`
38 |
39 | Required. The permission to update.
40 |
41 | The permission's ``name`` field is used to identify the
42 | permission to update.
43 |
44 | |
45 |
46 |
47 |
48 | `update_mask`
49 |
50 | |
51 |
52 |
53 | `google.protobuf.field_mask_pb2.FieldMask`
54 |
55 | Required. The list of fields to update. Accepted ones:
56 |
57 | - role (Permission.role field)
58 |
59 | |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/UpdateTunedModelRequest.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.UpdateTunedModelRequest
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Request to update a TunedModel.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `tuned_model`
33 |
34 | |
35 |
36 |
37 | `google.ai.generativelanguage.TunedModel`
38 |
39 | Required. The tuned model to update.
40 |
41 | |
42 |
43 |
44 |
45 | `update_mask`
46 |
47 | |
48 |
49 |
50 | `google.protobuf.field_mask_pb2.FieldMask`
51 |
52 | Required. The list of fields to update.
53 |
54 | |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/protos/VideoMetadata.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.protos.VideoMetadata
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Metadata for a video ``File``.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `video_duration`
33 |
34 | |
35 |
36 |
37 | `google.protobuf.duration_pb2.Duration`
38 |
39 | Duration of the video.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/AnyModelNameOptions.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.AnyModelNameOptions
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | AnyModelNameOptions = Union[
13 | str,
14 | google.generativeai.types.Model
,
15 | google.generativeai.protos.Model
,
16 | google.generativeai.types.TunedModel
,
17 | google.generativeai.protos.TunedModel
18 | ]
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/BaseModelNameOptions.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.BaseModelNameOptions
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | BaseModelNameOptions = Union[
13 | str,
14 | google.generativeai.types.Model
,
15 | google.generativeai.protos.Model
16 | ]
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/BlobDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.BlobDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/BlobType.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.BlobType
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | BlobType = Union[
13 | google.generativeai.protos.Blob
,
14 | google.generativeai.types.BlobDict
,
15 | PIL.Image.Image,
16 | IPython.core.display.Image
17 | ]
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/BlockedPromptException.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.BlockedPromptException
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Common base class for all non-exit exceptions.
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/BrokenResponseError.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.BrokenResponseError
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Common base class for all non-exit exceptions.
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/CitationMetadataDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.CitationMetadataDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | A collection of source attributions for a piece of content.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | Attributes |
28 |
29 |
30 |
31 |
32 | `citation_sources`
33 |
34 | |
35 |
36 |
37 | `MutableSequence[google.ai.generativelanguage.CitationSource]`
38 |
39 | Citations to sources for a specific response.
40 |
41 | |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/ContentDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.ContentDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/ContentFilterDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.ContentFilterDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Content filtering metadata associated with processing a single request.
18 |
19 |
20 | ContentFilter contains a reason and an optional supporting
21 | string. The reason may be unspecified.
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | Attributes |
31 |
32 |
33 |
34 |
35 | `reason`
36 |
37 | |
38 |
39 |
40 | `google.ai.generativelanguage.ContentFilter.BlockedReason`
41 |
42 | The reason content was blocked during request
43 | processing.
44 |
45 | |
46 |
47 |
48 |
49 | `message`
50 |
51 | |
52 |
53 |
54 | `str`
55 |
56 | A string that describes the filtering
57 | behavior in more detail.
58 |
59 | |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/FileDataDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.FileDataDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/FileDataType.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.FileDataType
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | FileDataType = Union[
13 | google.generativeai.types.FileDataDict
,
14 | google.generativeai.protos.FileData
,
15 | google.generativeai.protos.File
,
16 | google.generativeai.types.File
17 | ]
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/FunctionDeclarationType.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.FunctionDeclarationType
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | FunctionDeclarationType = Union[
13 | google.generativeai.types.FunctionDeclaration
,
14 | google.generativeai.protos.FunctionDeclaration
,
15 | dict[str, Any],
16 | Callable[..., Any]
17 | ]
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/GenerationConfigDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.GenerationConfigDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/GenerationConfigType.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.GenerationConfigType
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | GenerationConfigType = Union[
13 | google.generativeai.protos.GenerationConfig
,
14 | google.generativeai.types.GenerationConfigDict
,
15 | google.generativeai.types.GenerationConfig
16 | ]
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/IncompleteIterationError.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.IncompleteIterationError
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Common base class for all non-exit exceptions.
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/ModelsIterable.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.ModelsIterable
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | ModelsIterable = Iterable[
13 | google.generativeai.types.Model
14 | ]
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/PartDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.PartDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/PartType.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.PartType
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | PartType = Union[
13 | google.generativeai.protos.Part
,
14 | google.generativeai.types.PartDict
,
15 | google.generativeai.protos.Blob
,
16 | google.generativeai.types.BlobDict
,
17 | PIL.Image.Image,
18 | IPython.core.display.Image,
19 | str,
20 | google.generativeai.protos.FunctionCall
,
21 | google.generativeai.protos.FunctionResponse
,
22 | google.generativeai.types.FileDataDict
,
23 | google.generativeai.protos.FileData
,
24 | google.generativeai.protos.File
,
25 | google.generativeai.types.File
26 | ]
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/RequestOptionsType.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.RequestOptionsType
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | RequestOptionsType = Union[
13 | google.generativeai.types.RequestOptions
,
14 | google.generativeai.types.helper_types.RequestOptionsDict
15 | ]
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/SafetyFeedbackDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.SafetyFeedbackDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Safety feedback for an entire request.
18 |
19 |
20 |
21 | This field is populated if content in the input and/or response
22 | is blocked due to safety settings. SafetyFeedback may not exist
23 | for every HarmCategory. Each SafetyFeedback will return the
24 | safety settings used by the request as well as the lowest
25 | HarmProbability that should be allowed in order to return a
26 | result.
27 |
28 |
29 |
30 |
31 |
32 |
33 | Attributes |
34 |
35 |
36 |
37 |
38 | `rating`
39 |
40 | |
41 |
42 |
43 | `google.ai.generativelanguage.SafetyRating`
44 |
45 | Safety rating evaluated from content.
46 |
47 | |
48 |
49 |
50 |
51 | `setting`
52 |
53 | |
54 |
55 |
56 | `google.ai.generativelanguage.SafetySetting`
57 |
58 | Safety settings applied to the request.
59 |
60 | |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/SafetySettingDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.SafetySettingDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Safety setting, affecting the safety-blocking behavior.
18 |
19 |
20 |
21 | Passing a safety setting for a category changes the allowed
22 | probability that content is blocked.
23 |
24 |
25 |
26 |
27 |
28 |
29 | Attributes |
30 |
31 |
32 |
33 |
34 | `category`
35 |
36 | |
37 |
38 |
39 | `google.ai.generativelanguage.HarmCategory`
40 |
41 | Required. The category for this setting.
42 |
43 | |
44 |
45 |
46 |
47 | `threshold`
48 |
49 | |
50 |
51 |
52 | `google.ai.generativelanguage.SafetySetting.HarmBlockThreshold`
53 |
54 | Required. Controls the probability threshold
55 | at which harm is blocked.
56 |
57 | |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/Status.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.Status
3 |
4 |
5 |
6 |
9 |
10 |
11 |
12 | A ProtocolMessage
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | Attributes |
23 |
24 |
25 |
26 |
27 | `code`
28 |
29 | |
30 |
31 |
32 | `int32 code`
33 |
34 | |
35 |
36 |
37 |
38 | `details`
39 |
40 | |
41 |
42 |
43 | `repeated Any details`
44 |
45 | |
46 |
47 |
48 |
49 | `message`
50 |
51 | |
52 |
53 |
54 | `string message`
55 |
56 | |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/StopCandidateException.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.StopCandidateException
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Common base class for all non-exit exceptions.
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/StrictContentType.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.StrictContentType
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | StrictContentType = Union[
13 | google.generativeai.protos.Content
,
14 | google.generativeai.types.ContentDict
15 | ]
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/ToolDict.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.ToolDict
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/TunedModelNameOptions.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.TunedModelNameOptions
3 |
4 |
5 | This symbol is a **type alias**.
6 |
7 |
8 |
9 | #### Source:
10 |
11 |
12 | TunedModelNameOptions = Union[
13 | str,
14 | google.generativeai.types.TunedModel
,
15 | google.generativeai.protos.TunedModel
16 | ]
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/get_default_file_client.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.get_default_file_client
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | google.generativeai.types.get_default_file_client() -> glm.FilesServiceClient
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/types/to_file_data.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.types.to_file_data
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | google.generativeai.types.to_file_data(
22 | file_data: FileDataType
23 | )
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/api/google/generativeai/update_tuned_model.md:
--------------------------------------------------------------------------------
1 |
2 | # google.generativeai.update_tuned_model
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 | Calls the API to push updates to a specified tuned model where only certain attributes are updatable.
18 |
19 |
20 |
21 | google.generativeai.update_tuned_model(
22 | tuned_model: (str | protos.TunedModel),
23 | updates: (dict[str, Any] | None) = None,
24 | *,
25 | client: (glm.ModelServiceClient | None) = None,
26 | request_options: (helper_types.RequestOptionsType | None) = None
27 | ) -> model_types.TunedModel
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/google/generativeai/notebook/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | """Notebook extensions for Generative AI."""
16 |
17 |
18 | def load_ipython_extension(ipython):
19 | """Register the Colab Magic extension to support %load_ext."""
20 | # pylint: disable-next=g-import-not-at-top
21 | from google.generativeai.notebook import magics
22 |
23 | ipython.register_magics(magics.Magics)
24 |
25 | # Since we're in an interactive environment, make the tables prettier.
26 | try:
27 | # pylint: disable-next=g-import-not-at-top
28 | from google import colab # type: ignore
29 |
30 | colab.data_table.enable_dataframe_formatter()
31 | except ImportError:
32 | pass
33 |
--------------------------------------------------------------------------------
/google/generativeai/notebook/ipython_env_impl.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | """IPythonEnvImpl."""
16 | from __future__ import annotations
17 |
18 | from typing import Any
19 | from google.generativeai.notebook import ipython_env
20 | from IPython.core import display as ipython_display
21 |
22 |
23 | class IPythonEnvImpl(ipython_env.IPythonEnv):
24 | """Concrete implementation of IPythonEnv."""
25 |
26 | def display(self, x: Any) -> None:
27 | ipython_display.display(x)
28 |
29 | def display_html(self, x: str) -> None:
30 | ipython_display.display(ipython_display.HTML(x))
31 |
--------------------------------------------------------------------------------
/google/generativeai/notebook/lib/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
--------------------------------------------------------------------------------
/google/generativeai/notebook/lib/prompt_utils.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | """Utilities for processing prompts."""
16 | from __future__ import annotations
17 |
18 | import string
19 | from typing import AbstractSet
20 |
21 |
22 | def get_placeholders(prompt: str) -> AbstractSet[str]:
23 | """Returns the placeholders for `prompt`.
24 |
25 | E.g. Given "A for {word_one} B for {word_two}", returns {"word_one",
26 | "word_two"}.
27 |
28 | Args:
29 | prompt: A prompt template with optional placeholders.
30 |
31 | Returns:
32 | A sequence of placeholders in `prompt`.
33 | """
34 | placeholders: list[str] = []
35 | for _, field_name, _, _ in string.Formatter().parse(prompt):
36 | if field_name is not None:
37 | placeholders.append(field_name)
38 | return frozenset(placeholders)
39 |
--------------------------------------------------------------------------------
/google/generativeai/notebook/lib/unique_fn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | """Function for de-duping results."""
16 | from __future__ import annotations
17 |
18 | from typing import Sequence
19 | from google.generativeai.notebook.lib import llmfn_output_row
20 |
21 |
22 | def unique_fn(
23 | rows: Sequence[llmfn_output_row.LLMFnOutputRowView],
24 | ) -> Sequence[int]:
25 | """Returns a list of indices with duplicates removed.
26 |
27 | E.g. if rows has results ["hello", "hello", "world"], the return value would
28 | be [0, 2], indicating that the results at index 1 is a duplicate and should be
29 | removed.
30 |
31 | Args:
32 | rows: The input rows
33 |
34 | Returns:
35 | A sequence of indices indicating which entries have unique results.
36 | """
37 | indices: list[int] = []
38 | seen_entries = set()
39 | for idx, row in enumerate(rows):
40 | value = row.result_value()
41 | if value in seen_entries:
42 | continue
43 |
44 | seen_entries.add(value)
45 | indices.append(idx)
46 |
47 | return indices
48 |
--------------------------------------------------------------------------------
/google/generativeai/notebook/post_process_utils_test_helper.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | """Helper module for post_process_utils_test."""
16 | from __future__ import annotations
17 |
18 | from google.generativeai.notebook import post_process_utils
19 |
20 |
21 | def add_length(x: str) -> int:
22 | return len(x)
23 |
24 |
25 | @post_process_utils.post_process_add_fn
26 | def add_length_decorated(x: str) -> int:
27 | return len(x)
28 |
29 |
30 | @post_process_utils.post_process_replace_fn
31 | def to_upper(x: str) -> str:
32 | return x.upper()
33 |
--------------------------------------------------------------------------------
/google/generativeai/py.typed:
--------------------------------------------------------------------------------
1 | # see: https://peps.python.org/pep-0561/
2 |
--------------------------------------------------------------------------------
/google/generativeai/types/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | """A collection of type definitions used throughout the library."""
16 |
17 | from google.generativeai.types.citation_types import *
18 | from google.generativeai.types.content_types import *
19 | from google.generativeai.types.file_types import *
20 | from google.generativeai.types.generation_types import *
21 | from google.generativeai.types.helper_types import *
22 | from google.generativeai.types.model_types import *
23 | from google.generativeai.types.permission_types import *
24 | from google.generativeai.types.safety_types import *
25 |
26 |
27 | del model_types
28 | del citation_types
29 | del safety_types
30 |
--------------------------------------------------------------------------------
/google/generativeai/types/citation_types.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from __future__ import annotations
16 | from typing import List
17 |
18 | from typing_extensions import TypedDict
19 |
20 | from google.generativeai import protos
21 | from google.generativeai import string_utils
22 |
23 |
24 | __all__ = [
25 | "CitationMetadataDict",
26 | "CitationSourceDict",
27 | ]
28 |
29 |
30 | class CitationSourceDict(TypedDict):
31 | start_index: int | None
32 | end_index: int | None
33 | uri: str | None
34 | license: str | None
35 |
36 | __doc__ = string_utils.strip_oneof(protos.CitationSource.__doc__)
37 |
38 |
39 | class CitationMetadataDict(TypedDict):
40 | citation_sources: List[CitationSourceDict | None]
41 |
42 | __doc__ = string_utils.strip_oneof(protos.CitationMetadata.__doc__)
43 |
--------------------------------------------------------------------------------
/google/generativeai/types/text_types.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from __future__ import annotations
16 |
17 | import sys
18 | import abc
19 | import dataclasses
20 | from typing import Any, Dict, List
21 | from typing_extensions import TypedDict
22 |
23 | from google.generativeai import string_utils
24 | from google.generativeai.types import citation_types
25 |
26 |
27 | class EmbeddingDict(TypedDict):
28 | embedding: list[float]
29 |
30 |
31 | class BatchEmbeddingDict(TypedDict):
32 | embedding: list[list[float]]
33 |
--------------------------------------------------------------------------------
/google/generativeai/utils.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from __future__ import annotations
16 |
17 |
18 | def flatten_update_paths(updates):
19 | """Flattens a nested dictionary into a single level dictionary, with keys representing the original path."""
20 |
21 | new_updates = {}
22 | for key, value in updates.items():
23 | if isinstance(value, dict):
24 | for sub_key, sub_value in flatten_update_paths(value).items():
25 | new_updates[f"{key}.{sub_key}"] = sub_value
26 | else:
27 | new_updates[key] = value
28 |
29 | return new_updates
30 |
--------------------------------------------------------------------------------
/google/generativeai/version.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from __future__ import annotations
16 |
17 | __version__ = "0.8.4"
18 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.pytype]
2 | inputs = ['google', 'tests']
3 | exclude = ['build']
4 |
5 | [tool.black]
6 | line-length = 100
7 |
--------------------------------------------------------------------------------
/samples/configure_model_parameters.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from absl.testing import absltest
16 |
17 |
18 | class UnitTests(absltest.TestCase):
19 | def test_configure_model(self):
20 | # [START configure_model_parameters]
21 | import google.generativeai as genai
22 |
23 | model = genai.GenerativeModel("gemini-1.5-flash")
24 | response = model.generate_content(
25 | "Tell me a story about a magic backpack.",
26 | generation_config=genai.types.GenerationConfig(
27 | # Only one candidate for now.
28 | candidate_count=1,
29 | stop_sequences=["x"],
30 | max_output_tokens=20,
31 | temperature=1.0,
32 | ),
33 | )
34 |
35 | print(response.text)
36 | # [END configure_model_parameters]
37 |
38 |
39 | if __name__ == "__main__":
40 | absltest.main()
41 |
--------------------------------------------------------------------------------
/samples/embed.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from absl.testing import absltest
16 |
17 |
18 | class UnitTests(absltest.TestCase):
19 | def test_embed_content(self):
20 | # [START embed_content]
21 | import google.generativeai as genai
22 |
23 | text = "Hello World!"
24 | result = genai.embed_content(
25 | model="models/text-embedding-004", content=text, output_dimensionality=10
26 | )
27 | print(result["embedding"])
28 | # [END embed_content]
29 |
30 | def batch_embed_contents(self):
31 | # [START batch_embed_contents]
32 | import google.generativeai as genai
33 |
34 | texts = [
35 | "What is the meaning of life?",
36 | "How much wood would a woodchuck chuck?",
37 | "How does the brain work?",
38 | ]
39 | result = genai.embed_content(
40 | model="models/text-embedding-004", content=texts, output_dimensionality=10
41 | )
42 | print(result)
43 | # [END batch_embed_contents]
44 |
45 |
46 | if __name__ == "__main__":
47 | absltest.main()
48 |
--------------------------------------------------------------------------------
/samples/increment_tuning_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "text_input": "1",
4 | "output": "2"
5 | },
6 | {
7 | "text_input": "3",
8 | "output": "4"
9 | },
10 | {
11 | "text_input": "-3",
12 | "output": "-2"
13 | },
14 | {
15 | "text_input": "twenty two",
16 | "output": "twenty three"
17 | },
18 | {
19 | "text_input": "two hundred",
20 | "output": "two hundred one"
21 | },
22 | {
23 | "text_input": "ninety nine",
24 | "output": "one hundred"
25 | },
26 | {
27 | "text_input": "8",
28 | "output": "9"
29 | },
30 | {
31 | "text_input": "-98",
32 | "output": "-97"
33 | },
34 | {
35 | "text_input": "1,000",
36 | "output": "1,001"
37 | },
38 | {
39 | "text_input": "10,100,000",
40 | "output": "10,100,001"
41 | },
42 | {
43 | "text_input": "thirteen",
44 | "output": "fourteen"
45 | },
46 | {
47 | "text_input": "eighty",
48 | "output": "eighty one"
49 | },
50 | {
51 | "text_input": "one",
52 | "output": "two"
53 | },
54 | {
55 | "text_input": "three",
56 | "output": "four"
57 | },
58 | {
59 | "text_input": "seven",
60 | "output": "eight"
61 | }
62 | ]
--------------------------------------------------------------------------------
/samples/models.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from absl.testing import absltest
16 |
17 |
18 | class UnitTests(absltest.TestCase):
19 | def test_models_list(self):
20 | # [START models_list]
21 | import google.generativeai as genai
22 |
23 | print("List of models that support generateContent:\n")
24 | for m in genai.list_models():
25 | if "generateContent" in m.supported_generation_methods:
26 | print(m.name)
27 |
28 | print("List of models that support embedContent:\n")
29 | for m in genai.list_models():
30 | if "embedContent" in m.supported_generation_methods:
31 | print(m.name)
32 | # [END models_list]
33 |
34 | def test_models_get(self):
35 | # [START models_get]
36 | import google.generativeai as genai
37 |
38 | model_info = genai.get_model("models/gemini-1.5-flash-latest")
39 | print(model_info)
40 | # [END models_get]
41 |
42 |
43 | if __name__ == "__main__":
44 | absltest.main()
45 |
--------------------------------------------------------------------------------
/samples/rest/configure_model_parameters.sh:
--------------------------------------------------------------------------------
1 | set -eu
2 |
3 | echo "[START configure_model_parameters]"
4 | # [START configure_model_parameters]
5 | curl https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$GOOGLE_API_KEY \
6 | -H 'Content-Type: application/json' \
7 | -X POST \
8 | -d '{
9 | "contents": [{
10 | "parts":[
11 | {"text": "Write a story about a magic backpack."}
12 | ]
13 | }],
14 | "safetySettings": [
15 | {
16 | "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
17 | "threshold": "BLOCK_ONLY_HIGH"
18 | }
19 | ],
20 | "generationConfig": {
21 | "stopSequences": [
22 | "Title"
23 | ],
24 | "temperature": 1.0,
25 | "maxOutputTokens": 800,
26 | "topP": 0.8,
27 | "topK": 10
28 | }
29 | }' 2> /dev/null | grep "text"
30 | # [END configure_model_parameters]
31 |
--------------------------------------------------------------------------------
/samples/rest/controlled_generation.sh:
--------------------------------------------------------------------------------
1 | set -eu
2 |
3 | echo "json_controlled_generation"
4 | # [START json_controlled_generation]
5 | curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$GOOGLE_API_KEY" \
6 | -H 'Content-Type: application/json' \
7 | -d '{
8 | "contents": [{
9 | "parts":[
10 | {"text": "List 5 popular cookie recipes"}
11 | ]
12 | }],
13 | "generationConfig": {
14 | "response_mime_type": "application/json",
15 | "response_schema": {
16 | "type": "ARRAY",
17 | "items": {
18 | "type": "OBJECT",
19 | "properties": {
20 | "recipe_name": {"type":"STRING"},
21 | }
22 | }
23 | }
24 | }
25 | }' 2> /dev/null | head
26 | # [END json_controlled_generation]
27 |
28 | echo "json_no_schema"
29 | # [START json_no_schema]
30 | curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$GOOGLE_API_KEY" \
31 | -H 'Content-Type: application/json' \
32 | -d '{
33 | "contents": [{
34 | "parts":[
35 | {"text": "List a few popular cookie recipes using this JSON schema:
36 |
37 | Recipe = {\"recipe_name\": str}
38 | Return: list[Recipe]"
39 | }
40 | ]
41 | }],
42 | "generationConfig": { "response_mime_type": "application/json" }
43 | }' 2> /dev/null | head
44 | # [END json_no_schema]
45 |
--------------------------------------------------------------------------------
/samples/rest/embed.sh:
--------------------------------------------------------------------------------
1 | set -eu
2 |
3 | echo "[START embed_content]"
4 | # [START embed_content]
5 | curl "https://generativelanguage.googleapis.com/v1beta/models/text-embedding-004:embedContent?key=$GOOGLE_API_KEY" \
6 | -H 'Content-Type: application/json' \
7 | -d '{"model": "models/text-embedding-004",
8 | "content": {
9 | "parts":[{
10 | "text": "Hello world"}]}, }' 2> /dev/null | head
11 | # [END embed_content]
12 |
13 | echo "[START batch_embed_contents]"
14 | # [START batch_embed_contents]
15 | curl "https://generativelanguage.googleapis.com/v1beta/models/text-embedding-004:batchEmbedContents?key=$GOOGLE_API_KEY" \
16 | -H 'Content-Type: application/json' \
17 | -d '{"requests": [{
18 | "model": "models/text-embedding-004",
19 | "content": {
20 | "parts":[{
21 | "text": "What is the meaning of life?"}]}, },
22 | {
23 | "model": "models/text-embedding-004",
24 | "content": {
25 | "parts":[{
26 | "text": "How much wood would a woodchuck chuck?"}]}, },
27 | {
28 | "model": "models/text-embedding-004",
29 | "content": {
30 | "parts":[{
31 | "text": "How does the brain work?"}]}, }, ]}' 2> /dev/null | grep -C 5 values
32 | # [END batch_embed_contents]
--------------------------------------------------------------------------------
/samples/rest/models.sh:
--------------------------------------------------------------------------------
1 | set -eu
2 |
3 | echo "[START models_list]"
4 | # [START models_list]
5 | curl https://generativelanguage.googleapis.com/v1beta/models?key=$GOOGLE_API_KEY
6 | # [END models_list]
7 |
8 | echo "[START models_get]"
9 | # [START models_get]
10 | curl https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash?key=$GOOGLE_API_KEY
11 | # [END models_get]
12 |
--------------------------------------------------------------------------------
/samples/rest/safety_settings.sh:
--------------------------------------------------------------------------------
1 | set -eu
2 |
3 | echo "[START safety_settings]"
4 | # [START safety_settings]
5 | echo '{
6 | "safetySettings": [
7 | {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_ONLY_HIGH"}
8 | ],
9 | "contents": [{
10 | "parts":[{
11 | "text": "'I support Martians Soccer Club and I think Jupiterians Football Club sucks! Write a ironic phrase about them.'"}]}]}' > request.json
12 |
13 | curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$GOOGLE_API_KEY" \
14 | -H 'Content-Type: application/json' \
15 | -X POST \
16 | -d @request.json 2> /dev/null
17 | # [END safety_settings]
18 |
19 | echo "[START safety_settings_multi]"
20 | # [START safety_settings_multi]
21 | echo '{
22 | "safetySettings": [
23 | {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_ONLY_HIGH"},
24 | {"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}
25 | ],
26 | "contents": [{
27 | "parts":[{
28 | "text": "'I support Martians Soccer Club and I think Jupiterians Football Club sucks! Write a ironic phrase about them.'"}]}]}' > request.json
29 |
30 | curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$GOOGLE_API_KEY" \
31 | -H 'Content-Type: application/json' \
32 | -X POST \
33 | -d @request.json 2> /dev/null
34 | # [END safety_settings_multi]
35 |
--------------------------------------------------------------------------------
/samples/rest/system_instruction.sh:
--------------------------------------------------------------------------------
1 | set -eu
2 |
3 | echo "[START system_instruction]"
4 | # [START system_instruction]
5 | curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$GOOGLE_API_KEY" \
6 | -H 'Content-Type: application/json' \
7 | -d '{ "system_instruction": {
8 | "parts":
9 | { "text": "You are a cat. Your name is Neko."}},
10 | "contents": {
11 | "parts": {
12 | "text": "Hello there"}}}'
13 | # [END system_instruction]
--------------------------------------------------------------------------------
/samples/system_instruction.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from absl.testing import absltest
16 |
17 |
18 | class UnitTests(absltest.TestCase):
19 | def test_system_instructions(self):
20 | # [START system_instruction]
21 | import google.generativeai as genai
22 |
23 | model = genai.GenerativeModel(
24 | "models/gemini-1.5-flash",
25 | system_instruction="You are a cat. Your name is Neko.",
26 | )
27 | response = model.generate_content("Good morning! How are you?")
28 | print(response.text)
29 | # [END system_instruction]
30 |
31 |
32 | if __name__ == "__main__":
33 | absltest.main()
34 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/tests/__init__.py
--------------------------------------------------------------------------------
/tests/notebook/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/tests/notebook/__init__.py
--------------------------------------------------------------------------------
/tests/notebook/lib/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/tests/notebook/lib/__init__.py
--------------------------------------------------------------------------------
/tests/notebook/lib/test_prompt_utils.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | from __future__ import annotations
16 |
17 | from absl.testing import absltest
18 | from google.generativeai.notebook.lib import prompt_utils
19 |
20 |
21 | class PromptUtilsTest(absltest.TestCase):
22 | def test_get_placeholders_empty(self):
23 | placeholders = prompt_utils.get_placeholders("")
24 | self.assertEmpty(placeholders)
25 |
26 | placeholders = prompt_utils.get_placeholders("There are no placeholders here")
27 | self.assertEmpty(placeholders)
28 |
29 | def test_get_placeholders(self):
30 | placeholders = prompt_utils.get_placeholders("today {hello} world")
31 | self.assertEqual(frozenset({"hello"}), placeholders)
32 |
33 | placeholders = prompt_utils.get_placeholders("{hello} {world}")
34 | self.assertEqual(frozenset({"hello", "world"}), placeholders)
35 |
36 | placeholders = prompt_utils.get_placeholders("{hello} {hello}")
37 | self.assertEqual(frozenset({"hello"}), placeholders)
38 |
39 |
40 | if __name__ == "__main__":
41 | absltest.main()
42 |
--------------------------------------------------------------------------------
/tests/notebook/test_model_registry.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | """Unittest for model_registry."""
16 | from __future__ import annotations
17 |
18 | from absl.testing import absltest
19 | from google.generativeai.notebook import model_registry
20 |
21 |
22 | class ModelRegistryTest(absltest.TestCase):
23 | def test_get_model_echo_model(self):
24 | registry = model_registry.ModelRegistry()
25 | model = registry.get_model(model_registry.ModelName.ECHO_MODEL)
26 | results = model.call_model(model_input="this_is_a_test")
27 | self.assertEqual("this_is_a_test", results.model_input)
28 |
29 | # Echo model returns the model_input as text results.
30 | self.assertEqual(["this_is_a_test"], results.text_results)
31 |
32 |
33 | if __name__ == "__main__":
34 | absltest.main()
35 |
--------------------------------------------------------------------------------
/tests/test.csv:
--------------------------------------------------------------------------------
1 | text_input,output
2 | a,1
3 | b,2
4 | c,3
5 |
--------------------------------------------------------------------------------
/tests/test1.json:
--------------------------------------------------------------------------------
1 | [
2 | {"text_input": "a", "output": "1"},
3 | {"text_input": "b", "output": "2"},
4 | {"text_input": "c", "output": "3"}
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/test2.json:
--------------------------------------------------------------------------------
1 | {"text_input": ["a", "b", "c"], "output": ["1", "2", "3"]}
2 |
--------------------------------------------------------------------------------
/tests/test3.json:
--------------------------------------------------------------------------------
1 | [
2 | ["a","1"],
3 | ["b","2"],
4 | ["c","3"]
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/test_img.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/tests/test_img.gif
--------------------------------------------------------------------------------
/tests/test_img.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/tests/test_img.jpg
--------------------------------------------------------------------------------
/tests/test_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/tests/test_img.png
--------------------------------------------------------------------------------
/tests/test_protos.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright 2023 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | import pathlib
16 | import re
17 |
18 | from absl.testing import absltest
19 | from absl.testing import parameterized
20 |
21 | ROOT = pathlib.Path(__file__).parent.parent
22 |
23 |
24 | class UnitTests(parameterized.TestCase):
25 | def test_check_glm_imports(self):
26 | for fpath in ROOT.rglob("*.py"):
27 | if fpath.name == "build_docs.py":
28 | continue
29 | content = fpath.read_text()
30 | for match in re.findall("glm\.\w+", content):
31 | self.assertIn(
32 | "Client",
33 | match,
34 | msg=f"Bad `glm.` usage, use `genai.protos` instead,\n in {fpath}",
35 | )
36 |
37 |
38 | if __name__ == "__main__":
39 | absltest.main()
40 |
--------------------------------------------------------------------------------
/third_party/Big_Buck_Bunny.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/third_party/Big_Buck_Bunny.mp4
--------------------------------------------------------------------------------
/third_party/Cajun_instruments.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/third_party/Cajun_instruments.jpg
--------------------------------------------------------------------------------
/third_party/LICENSE.txt:
--------------------------------------------------------------------------------
1 | * a11.txt
2 | * This is an apollo 11 transcript.
3 | * This file is in the public domain in the United States because it was solely created by NASA
4 | * Big_Buck_Bunny.mp4:
5 | * This is a clip from https://peach.blender.org/download/
6 | * License CC-BY 3.0 (Attribution)
7 | * poem.txt:
8 | * This is the first paragraph from Shakespeare's "spring", public domain.
9 | * Cajun_instruments.jpg
10 | * This image is from Wikimedia Commons, a public domain (https://commons.wikimedia.org/wiki/Category:Musical_instruments#/media/File:Cajun_instruments.jpg).
11 | * test.pdf
12 | * This is the first 2 pages of https://arxiv.org/abs/2403.05530 by Google Gemini Team.
13 | * License: CC-BY 4.0
--------------------------------------------------------------------------------
/third_party/organ.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/third_party/organ.jpg
--------------------------------------------------------------------------------
/third_party/poem.txt:
--------------------------------------------------------------------------------
1 | When daisies pied, and violets blue,
2 | And lady-smocks all silver-white,
3 | And cuckoo-buds of yellow hue
4 | Do paint the meadows with delight
5 |
--------------------------------------------------------------------------------
/third_party/sample.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/third_party/sample.mp3
--------------------------------------------------------------------------------
/third_party/test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0joseDark/generative-ai-python/362e0010dd2ebc67de4fee2278301e6d19702912/third_party/test.pdf
--------------------------------------------------------------------------------