Python client library for Google Gemini AI API - GenerativeService API
Project description
Gemini Client - Python SDK for Google Gemini AI API
A comprehensive Python client library for Google's Gemini AI API. This package provides easy-to-use interfaces for text generation, chat, embeddings, and multimodal AI capabilities.
Author: Qaadir
Email: qaadireng@gmail.com
GitHub: github.com/AbQaadir
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.0.1
- Package version: 1.0.0
- Generator version: 7.14.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Requirements
Python 3.9+
Installation & Usage
pip install
pip install gemini-client
From source
If you want to install from source:
pip install git+https://github.com/AbQaadir/gemini-client.git
Then import the package:
import openapi_client
Tests
Execute pytest to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://generativelanguage.googleapis.com
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://generativelanguage.googleapis.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.GenerativeServiceApi(api_client)
model = 'model_example' # str | The model id.
batch_embed_contents_request = openapi_client.BatchEmbedContentsRequest() # BatchEmbedContentsRequest |
try:
api_response = api_instance.generative_service_batch_embed_contents(model, batch_embed_contents_request)
print("The response of GenerativeServiceApi->generative_service_batch_embed_contents:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling GenerativeServiceApi->generative_service_batch_embed_contents: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to https://generativelanguage.googleapis.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| GenerativeServiceApi | generative_service_batch_embed_contents | POST /v1beta/models/{model}:batchEmbedContents | |
| GenerativeServiceApi | generative_service_count_tokens | POST /v1beta/models/{model}:countTokens | |
| GenerativeServiceApi | generative_service_embed_content | POST /v1beta/models/{model}:embedContent | |
| GenerativeServiceApi | generative_service_generate_answer | POST /v1beta/models/{model}:generateAnswer | |
| GenerativeServiceApi | generative_service_generate_dynamic_content | POST /v1beta/dynamic/{dynamic}:generateContent | |
| GenerativeServiceApi | generative_service_generate_model_content | POST /v1beta/models/{model}:generateContent | |
| GenerativeServiceApi | generative_service_generate_tuned_model_content | POST /v1beta/tunedModels/{tunedModel}:generateContent | |
| GenerativeServiceApi | generative_service_stream_generate_dynamic_content | POST /v1beta/dynamic/{dynamic}:streamGenerateContent | |
| GenerativeServiceApi | generative_service_stream_generate_model_content | POST /v1beta/models/{model}:streamGenerateContent | |
| GenerativeServiceApi | generative_service_stream_generate_tuned_model_content | POST /v1beta/tunedModels/{tunedModel}:streamGenerateContent |
Documentation For Models
- AttributionSourceId
- AttributionSourceIdGroundingPassageId
- AttributionSourceIdSemanticRetrieverChunk
- BatchEmbedContentsRequest
- BatchEmbedContentsResponse
- Blob
- Candidate
- CitationMetadata
- CitationSource
- CodeExecutionResult
- Condition
- Content
- ContentEmbedding
- CountTokensRequest
- CountTokensResponse
- DynamicRetrievalConfig
- EmbedContentRequest
- EmbedContentResponse
- ExecutableCode
- FileData
- FunctionCall
- FunctionCallingConfig
- FunctionDeclaration
- FunctionResponse
- GenerateAnswerRequest
- GenerateAnswerResponse
- GenerateAnswerResponseInputFeedback
- GenerateContentRequest
- GenerateContentResponse
- GenerateContentResponsePromptFeedback
- GenerateContentResponseUsageMetadata
- GenerationConfig
- GoogleProtobufAny
- GoogleSearchRetrieval
- GroundingAttribution
- GroundingChunk
- GroundingChunkWeb
- GroundingMetadata
- GroundingPassage
- GroundingPassages
- GroundingSupport
- Interval
- LogprobsResult
- LogprobsResultCandidate
- LogprobsResultTopCandidates
- MetadataFilter
- ModalityTokenCount
- ModelSchema
- MultiSpeakerVoiceConfig
- Part
- PrebuiltVoiceConfig
- RetrievalMetadata
- SafetyRating
- SafetySetting
- SearchEntryPoint
- Segment
- SemanticRetrieverConfig
- SpeakerVoiceConfig
- SpeechConfig
- Status
- ThinkingConfig
- Tool
- ToolConfig
- ToolGoogleSearch
- UrlContextMetadata
- UrlMetadata
- VideoMetadata
- VoiceConfig
Documentation For Authorization
Authentication schemes defined for the API:
ApiKeyAuth
- Type: API key
- API key parameter name: x-goog-api-key
- Location: HTTP header
Author
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gemini_client-1.0.0.tar.gz.
File metadata
- Download URL: gemini_client-1.0.0.tar.gz
- Upload date:
- Size: 87.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08b3d0572304c45db35c1da7c81730838c61d4dcf7efb7a3aee8af9076d46ce9
|
|
| MD5 |
ab27075a5604481c91048c6c6fece31f
|
|
| BLAKE2b-256 |
702fa601aeb1e5a6d3eee384741146aec4d3a36ea5a7da5a595f084cc7a55e0e
|
File details
Details for the file gemini_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gemini_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 143.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb6d750a9a9b9f833f2f24549f61da0d8081b1add90ca4cc0c984ff136bd4c8f
|
|
| MD5 |
09183c78302b59435f3e071fec1f4da6
|
|
| BLAKE2b-256 |
043903e6136ea9266b785fdc903a3b83b811e1eb203991a91bb2f51399d6a6e7
|