google_tracer
GenerateContentResponse(done, iterator, result, impacts, *args, **kwargs)
Bases: GenerateContentResponse
Wrapper of google.generativeai.types.GenerateContentResponse
with ImpactsOutput
Source code in ecologits/tracers/google_tracer.py
AsyncGenerateContentResponse(done, iterator, result, impacts, *args, **kwargs)
Bases: AsyncGenerateContentResponse
Wrapper of google.generativeai.types.AsyncGenerateContentResponse
with ImpactsOutput
Source code in ecologits/tracers/google_tracer.py
GoogleInstrumentor()
Instrumentor initialized by EcoLogits to automatically wrap all Google calls
Source code in ecologits/tracers/google_tracer.py
google_chat_wrapper(wrapped, instance, args, kwargs)
Function that wraps a Google answer with computed impacts
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wrapped |
Callable
|
Callable that returns the LLM response |
required |
instance |
GenerativeModel
|
Never used - for compatibility with |
required |
args |
Any
|
Arguments of the callable |
required |
kwargs |
Any
|
Keyword arguments of the callable |
required |
Returns:
Type | Description |
---|---|
Union[GenerateContentResponse, Iterable[GenerateContentResponse]]
|
A wrapped |
Source code in ecologits/tracers/google_tracer.py
google_async_chat_wrapper(wrapped, instance, args, kwargs)
async
Function that wraps a Google answer with computed impacts in async mode
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wrapped |
Callable
|
Async callable that returns the LLM response |
required |
instance |
GenerativeModel
|
Never used - for compatibility with |
required |
args |
Any
|
Arguments of the callable |
required |
kwargs |
Any
|
Keyword arguments of the callable |
required |
Returns:
Type | Description |
---|---|
Union[AsyncGenerateContentResponse, Iterable[AsyncGenerateContentResponse]]
|
A wrapped |