View module source on GitHub

MaximGeminiAsyncChatSession

class MaximGeminiAsyncChatSession(AsyncChat)
Maxim Gemini async chat session. This class represents a maxim gemini async chat session.

__init__

def __init__(chat: AsyncChat,
             logger: Logger,
             trace_id: Optional[str] = None,
             is_local_trace: Optional[bool] = False)
Initialize a maxim gemini async chat session. Arguments:
NameDescription
chatThe chat.
loggerThe logger.
trace_idThe trace id.
is_local_traceWhether the trace is local.

send_message

@override
async def send_message(
        message: Union[list[PartUnionDict], PartUnionDict],
        generation_name: Optional[str] = None) -> GenerateContentResponse
Send a message to the chat. Arguments:
NameDescription
messageThe message to send.
generation_nameThe name of the generation.
Returns:
NameDescription
GenerateContentResponseThe response from the chat.

send_message_stream

@override
async def send_message_stream(
    message: Union[list[PartUnionDict], PartUnionDict],
    generation_name: Optional[str] = None
) -> Awaitable[AsyncIterator[GenerateContentResponse]]
Send a message to the chat stream. Arguments:
NameDescription
messageThe message to send.
generation_nameThe name of the generation.
Returns:
NameDescription
Awaitable[AsyncIterator[GenerateContentResponse]]The response from the chat.

__getattr__

def __getattr__(name: str) -> Any
Get an attribute from the chat. Arguments:
NameDescription
nameThe name of the attribute.
Returns:
NameDescription
AnyThe attribute.

__setattr__

def __setattr__(name: str, value: Any) -> None
Set an attribute on the chat. Arguments:
NameDescription
nameThe name of the attribute.
valueThe value of the attribute.

end_trace

def end_trace()
End the trace. This method ends the trace if it is local and the trace id is not None.

MaximGeminiAsyncChats

class MaximGeminiAsyncChats(AsyncChats)
Maxim Gemini async chats. This class represents a maxim gemini async chats.

__init__

def __init__(chats: AsyncChats, logger: Logger)
Initialize a maxim gemini async chats.

create

@override
def create(*,
           model: str,
           config: GenerateContentConfigOrDict = None,
           history: Optional[list[Content]] = None,
           trace_id: Optional[str] = None) -> AsyncChat
Create a chat session. Arguments:
NameDescription
modelThe model to use.
configThe config to use.
historyThe history to use.
trace_idThe trace id.
Returns:
NameDescription
AsyncChatThe chat session.

__getattr__

def __getattr__(name: str) -> Any
Get an attribute from the chats. Arguments:
NameDescription
nameThe name of the attribute.
Returns:
NameDescription
AnyThe attribute.

__setattr__

def __setattr__(name: str, value: Any) -> None
Set an attribute on the chats. Arguments:
NameDescription
nameThe name of the attribute.
valueThe value of the attribute.

MaximGeminiAsyncModels

class MaximGeminiAsyncModels(AsyncModels)
Maxim Gemini async models. This class represents a maxim gemini async models.

__init__

def __init__(models: AsyncModels, logger: Logger)
Initialize a maxim gemini async models. Arguments:
NameDescription
modelsThe models.
loggerThe logger.

generate_content_stream

@override
async def generate_content_stream(
    *,
    model: str,
    contents: Union[ContentListUnion, ContentListUnionDict],
    config: Optional[GenerateContentConfigOrDict] = None,
    trace_id: Optional[str] = None,
    generation_name: Optional[str] = None
) -> Awaitable[AsyncIterator[GenerateContentResponse]]
Generate content stream. Arguments:
NameDescription
modelThe model to use.
contentsThe contents to use.
configThe config to use.
trace_idThe trace id.
generation_nameThe generation name.
Returns:
NameDescription
Awaitable[AsyncIterator[GenerateContentResponse]]The response from the models.

generate_content

@override
async def generate_content(
        *,
        model: str,
        contents: Union[ContentListUnion, ContentListUnionDict],
        config: Optional[GenerateContentConfigOrDict] = None,
        trace_id: Optional[str] = None,
        generation_name: Optional[str] = None) -> GenerateContentResponse
Generate content. Arguments:
NameDescription
modelThe model to use.
contentsThe contents to use.
configThe config to use.
trace_idThe trace id.
generation_nameThe generation name.
Returns:
NameDescription
GenerateContentResponseThe response from the models.

__getattr__

def __getattr__(name: str) -> Any
Get an attribute from the models. Arguments:
NameDescription
nameThe name of the attribute.
Returns:
NameDescription
AnyThe attribute.

__setattr__

def __setattr__(name: str, value: Any) -> None
Set an attribute on the models. Arguments:
NameDescription
nameThe name of the attribute.
valueThe value of the attribute.

MaximGeminiAsyncClient

class MaximGeminiAsyncClient(AsyncClient)
Maxim Gemini async client. This class represents a maxim gemini async client.

__init__

def __init__(client: AsyncClient, logger: Logger)
Initialize a maxim gemini async client. Arguments:
NameDescription
clientThe client.
loggerThe logger.

__getattr__

def __getattr__(name: str) -> Any
Get an attribute from the client. Arguments:
NameDescription
nameThe name of the attribute.
Returns:
NameDescription
AnyThe attribute.

__setattr__

def __setattr__(name: str, value: Any) -> None
Set an attribute on the client. Arguments:
NameDescription
nameThe name of the attribute.
valueThe value of the attribute.