google_genai_tracer
GenerateContentResponse
Bases: GenerateContentResponse
Wrapper of google.genai.types.GenerateContentResponse
with ImpactsOutput
GoogleGenaiInstrumentor()
Instrumentor initialized by EcoLogits to automatically wrap all Google GenAI calls
Source code in ecologits/tracers/google_genai_tracer.py
google_genai_content_wrapper(wrapped, instance, args, kwargs)
Function that wraps Google GenAI answer with computed impacts
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wrapped |
Callable
|
Callable that returns the LLM response |
required |
instance |
Models
|
Never used - for compatibility with |
required |
args |
Any
|
Arguments of the callable |
required |
kwargs |
Any
|
Keyword arguments of the callable |
required |
Returns:
Type | Description |
---|---|
GenerateContentResponse
|
A wrapped |
Source code in ecologits/tracers/google_genai_tracer.py
google_genai_content_stream_wrapper(wrapped, instance, args, kwargs)
Function that wraps Google GenAI answer with computed impacts in streaming mode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wrapped |
Callable
|
Callable that returns the LLM response |
required |
instance |
Models
|
Never used - for compatibility with |
required |
args |
Any
|
Arguments of the callable |
required |
kwargs |
Any
|
Keyword arguments of the callable |
required |
Yields:
Type | Description |
---|---|
GenerateContentResponse
|
A wrapped |
Source code in ecologits/tracers/google_genai_tracer.py
google_genai_async_content_wrapper(wrapped, instance, args, kwargs)
async
Function that wraps Google GenAI answer with computed impacts in async mode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wrapped |
Callable
|
Callable that returns the LLM response |
required |
instance |
Models
|
Never used - for compatibility with |
required |
args |
Any
|
Arguments of the callable |
required |
kwargs |
Any
|
Keyword arguments of the callable |
required |
Returns:
Type | Description |
---|---|
GenerateContentResponse
|
A wrapped |
Source code in ecologits/tracers/google_genai_tracer.py
google_genai_async_content_stream_wrapper(wrapped, instance, args, kwargs)
async
Function that wraps Google GenAI answer with computed impacts in async and streaming mode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wrapped |
Callable
|
Callable that returns the LLM response |
required |
instance |
Models
|
Never used - for compatibility with |
required |
args |
Any
|
Arguments of the callable |
required |
kwargs |
Any
|
Keyword arguments of the callable |
required |
Yields:
Type | Description |
---|---|
AsyncIterator[GenerateContentResponse]
|
A wrapped |