myllm.handler.openai.OpenaiHandler#

class myllm.handler.openai.OpenaiHandler(**kwargs)[source]#

Bases: AIClient

MyLLM class for OpenAI and LocalAI

Initialize the object with the given keyword arguments.

Parameters:

kwargs – keyword arguments

Returns:

None

Methods

chat(prompt)

Asynchronously chats with the client based on the given prompt.

clear_chat_history()

Clears the chat history

export_chat_history()

Clears the chat history

import_chat_history()

Import chat history

vision(base64_image)

Asynchronously summarizes the content of an image based on the given base64 encoded image string.

async chat(prompt)[source]#

Asynchronously chats with the client based on the given prompt.

Parameters:

prompt – The prompt for the chat.

Returns:

The response from the chat.

async vision(base64_image)[source]#

Asynchronously summarizes the content of an image based on the given base64 encoded image string.

Parameters:

base64_image (str) – A base64 encoded image string.

Returns:

A summarized description of the image content.

Return type:

str

async clear_chat_history()#

Clears the chat history

async export_chat_history()#

Clears the chat history

async import_chat_history()#

Import chat history