talkingheads.model_libraryο
talkingheads.model_library.chatgptο
Class definition for ChatGPTClient
- class talkingheads.model_library.chatgpt.ChatGPTClient(**kwargs)ο
Bases:
BaseBrowserChatGPTClient class to interact with ChatGPT
- get_custom_instruction(mode: str) strο
Gets custom instructions
- Parameters:
mode (str) β Either βextra_informationβ or βmodulationβ. Check OpenAI help pages.
- get_last_response() strο
Retrieves the last response given by ChatGPT
- Returns:
The last response
- Return type:
str
- interact(prompt: str) strο
Sends a prompt and retrieves the response from the ChatGPT system.
This function interacts with the ChatGPT. It takes the prompt as input and sends it to the system. The prompt may contain multiple lines separated by βnβ. In this case, the function simulates pressing SHIFT+ENTER for each line. Upon arrival of the interaction, the function waits for the response. Once the response is ready, the function will return the response.
- Parameters:
prompt (str) β The interaction text.
- Returns:
The generated response.
- Return type:
str
- login(username: str, password: str)ο
Performs the login process with the provided username and password.
This function operates on the login page. It finds and clicks the login button, fills in the email and password textboxes
- Parameters:
username (str) β The username to be entered.
password (str) β The password to be entered.
- Returns:
None
- open_custom_instruction_tab() boolο
Opens the modal to access custom interactions.
- Returns:
True if the process is successful, False otherwise
- Return type:
bool
- pass_verification(max_trial: int = 10, wait_time: int = 1) boolο
Performs the verification process on the page if challenge is present.
This function checks if the login page is displayed in the browser. In that case, it looks for the verification button. This process is repeated until the login page is no longer displayed.
Returns: None
- postload_custom_func()ο
A function to implement custom instructions after loading the webpage
- regenerate_response() strο
Clicks the response to generate a new one and returns the new response.
- Parameters:
None β
- Returns:
str
- reset_thread() boolο
Function to close the current thread and start new one
- set_custom_instruction(mode: str, instruction: str)ο
Sets custom instructions
- Parameters:
mode (str) β Either βextra_informationβ or βmodulationβ. Check OpenAI help pages.
instruction (str) β _description_
- switch_model(model_name: str) boolο
Switch the model for ChatGPT+ users.
- Parameters:
model_name β str = The name of the model, either GPT-3.5 or GPT-4
- Returns:
True on success, False on fail
- Return type:
bool
talkingheads.model_library.claudeο
Class definition for Claude client
- class talkingheads.model_library.claude.ClaudeClient(**kwargs)ο
Bases:
BaseBrowserClaudeClient class to interact with Claude. It helps you to conncet to https://claude.ai/. Apart from core functionality Claude supports web search. It is not possible to regenerate a response by using Claude
- interact(prompt: str) strο
Sends a prompt and retrieves the response from the ChatGPT system.
This function interacts with the Claude. It takes the prompt as input and sends it to the system. The prompt may contain multiple lines separated by βnβ. In this case, the function simulates pressing SHIFT+ENTER for each line. Upon arrival of the interaction, the function waits for the response. Once the response is ready, the function will return the response.
- Parameters:
prompt (str) β The interaction text.
- Returns:
The generated response.
- Return type:
str
- is_ready_to_prompt() boolο
Checks if the Claude is ready to be prompted. The indication for an ongoing message generation process is a disabled send button. The indication for no input is the same disabled button. Therefore we put a dummy dot into the textarea and we are left with the only reason for the button to be disabled, that is, a message being generated.
- Returns:
return if the system is ready to be prompted.
- Return type:
bool
- login(_1: str | None = None, _2: str | None = None) boolο
It is only possible to login Claude manually.
- Parameters:
_1 (str) β Unused parameter 1.
_2 (str) β Unused parameter 2.
- Returns:
True
- Return type:
bool
- postload_custom_func() boolο
In order to continue chat screen, a click on start button is required
- regenerate_response() strο
Abstract function to regenerate the responses.
- reset_thread() boolο
Function to close the current thread and start new one
- Returns:
True if reset is successful, false otherwise.
- Return type:
bool
- switch_model(_: str) Noneο
Abstract function to switch the model.
- Parameters:
model_name β (str) = The name of the model.
talkingheads.model_library.copilotο
Class definition for Copilot client
- class talkingheads.model_library.copilot.CopilotClient(**kwargs)ο
Bases:
BaseBrowserPiClient class to interact with Pi. It helps you to connect to https://copilot.microsoft.com/. Apart from core functionality Copilot supports web search. It is not possible to regenerate a response by using Copilot
- get_last_response(check_greeting: bool = False) strο
Returns the last response in the chat view.
- Parameters:
check_greeting (bool) β If set, checks the greeting message, provided after clicking New Topic.
- Returns:
The last generated response
- Return type:
str
- get_models(get_active_model: bool = False) Dict[str, WebElement] | WebElementο
Get the current model. (style) :param get_active_model: bool = If set, returns the current element
- Returns:
Dictionary of models and their element.
- Return type:
Dict[str, WebElement]
- get_plugin(plugin_name: str) WebElement | Noneο
Returns if the plugin is enabled
- Parameters:
plugin_name (str) β The name of the plugin
- Returns:
True if the plugin is enabled, False if disabled. None if not plugin doesnβt exist
- Return type:
Union[WebElement, None]
- interact(prompt: str, image_path: str | Path | None = None) strο
Sends a prompt and retrieves the response from the Copilot system.
This function interacts with the Copilot. It takes the prompt as input and sends it to the system. The prompt may contain multiple lines separated by βnβ. In this case, the function simulates pressing SHIFT+ENTER for each line. Upon arrival of the interaction, the function waits for the response. Once the response is ready, the function will return the response.
- Parameters:
prompt (str) β The interaction text.
image_path (str, Optional) β The path to image from local, or the url of the image.
- Returns:
The generated response.
- Return type:
Dict[str]
- is_ready_to_prompt(text_area, shadow_element) boolο
Checks if the Copilot is ready to be prompted. The indication for an ongoing message generation process is a disabled send button. The indication for no input is the same disabled button. Therefore we put a dummy dot into the textarea and we are left with the only reason for the button to be disabled, that is, a message being generated.
- Returns:
return if the system is ready to be prompted.
- Return type:
bool
- login(username: str | None = None, password: str | None = None)ο
Performs the login process with the provided username and password. You donβt need to login to use Pi
This function operates on the login page. It finds and clicks the login button, fills in the email and password textboxes
- Parameters:
username (str) β The username to be entered.
password (str) β The password to be entered.
- Returns:
True
- Return type:
bool
- postload_custom_func() Noneο
Copilot requires to accept privacy terms, the cookie below provides the response.
- regenerate_response()ο
Abstract function to regenerate the responses.
- remove_attached_image() boolο
Removes the attached image from prompt
- Returns:
True if the action is valid
- Return type:
bool
- reset_thread() boolο
Function to close the current thread and start new one
- Returns:
False always, it is not possible to reset in Pi.
- Return type:
bool
- switch_model(model_name: str) boolο
Switch the model. (style)
- Parameters:
model_name β str = The name of the model
- Returns:
True on success, False on fail
- Return type:
bool
- toggle_plugin(plugin_name: str) boolο
Toggles the status of the plugin. In order to use plugins, search plugin should be active.
- Parameters:
plugin_name (str) β The name of the plugin
- Returns:
True if toggle action is successful, False if operation fails.
- Return type:
bool
- upload_image(action_bar: ShadowRoot, image_path: str | Path) boolο
Upload an image or a url and wait until it is uploaded, then returns.
- Parameters:
action_bar (ShadowRoot) β Action bar shadow root to find sub elements.
image_path (str) β the file path to image or the url.
- Returns:
True if the image loaded properly, False otherwise
- Return type:
bool
talkingheads.model_library.geminiο
Class definition for GeminiClient
- class talkingheads.model_library.gemini.GeminiClient(**kwargs)ο
Bases:
BaseBrowserGeminiClient class to interact with Gemini
- get_response() strο
Get the response from chat board
- Returns:
The interaction text
- Return type:
str
- interact(prompt: str, image_path: str | Path | None = None) strο
Sends a prompt and retrieves the response from the ChatGPT system.
This function interacts with the Gemini. It takes the prompt as input and sends it to the system. The prompt may contain multiple lines separated by βnβ. In this case, the function simulates pressing SHIFT+ENTER for each line. Upon arrival of the interaction, the function waits for the response. Once the response is ready, the function will return the response.
- Parameters:
prompt (str) β The interaction text.
image_path (str, optional) β The image path for multimodal functionality
- Returns:
The generated response.
- Return type:
str
- login(username: str, password: str) boolο
Performs the login process with the provided username and password.
This function operates on the login page. It finds and clicks the login button, fills in the email and password textboxes
- Parameters:
username (str) β The username to be entered.
password (str) β The password to be entered.
- Returns:
True if login succesful, False otherwise.
- Return type:
bool
- modify_response(mode: str) strο
Closes the current thread and starts a new one.
- Parameters:
mode β Select the modification mode.
- Returns:
The regenerated response or empty string in case of failure.
- Return type:
str
- postload_custom_func()ο
A function to implement custom instructions after loading the webpage
- regenerate_response() strο
Closes the current thread and starts a new one.
- Parameters:
None β
- Returns:
The regenerated response or empty string in case of failure.
- Return type:
str
- reset_thread() boolο
Function to close the current thread and start new one
- Returns:
True new chat button is clicked, false otherwise
- Return type:
bool
- switch_model(model_name: str) boolο
Abstract function to switch the model.
- Parameters:
model_name β (str) = The name of the model.
- upload_image(image_path: str | Path) boolο
Upload an image or a url and wait until it is uploaded, then returns.
- Parameters:
image_path (Union[str, Path]) β the file path to image or the url.
- Returns:
True if the image loaded properly, False otherwise.
- Return type:
bool
talkingheads.model_library.huggingchatο
Class definition for HuggingChat client
- class talkingheads.model_library.huggingchat.HuggingChatClient(**kwargs)ο
Bases:
BaseBrowserHuggingChatClient class to interact with HuggingChat. It helps you to conncet to https://huggingface.co/chat/ and login. Apart from core functionality HuggingChat supports web search. It is not possible to regenerate a response by using HuggingChat
- interact(prompt: str)ο
Sends a prompt and retrieves the response from the HuggingChat system.
This function interacts with the HuggingChat. It takes the prompt as input and sends it to the system. The prompt may contain multiple lines seperated by βnβ. In this case, the function simulates pressing SHIFT+ENTER for each line. Upon arrival of the interaction, the function waits for the response. Once the response is ready, the function will return the response.
- Parameters:
prompt (str) β The interaction text.
- Returns:
The generated response.
- Return type:
str
- login(username: str, password: str)ο
Performs the login process with the provided username and password.
This function operates on the login page. It finds and clicks the login button, fills in the email and password textboxes
- Parameters:
username (str) β The username to be entered.
password (str) β The password to be entered.
- Returns:
True if login is successful
- Return type:
bool
- regenerate_response()ο
Abstract function to regenerate the responses.
- reset_thread() boolο
Function to close the current thread and start new one
- switch_model(model_name: str) boolο
Switch the model.
- Parameters:
model_name β str = The name of the model
- Returns:
True on success, False on fail
- Return type:
bool
- toggle_search_web() boolο
Function to enable/disable web search feature
talkingheads.model_library.lechatο
Class definition for LeChat client
- class talkingheads.model_library.lechat.LeChatClient(**kwargs)ο
Bases:
BaseBrowserLeChatClient class to interact with LeChat. It helps you to conncet to https://chat.mistral.ai/chat and login. It is not possible to regenerate a response by using LeChat
- get_last_response() strο
Retrieves the last response given by ChatGPT
- Returns:
The last response
- Return type:
str
- interact(prompt: str)ο
Sends a prompt and retrieves the response.
This function interacts with the LeChat. It takes the prompt as input and sends it to the system. The prompt may contain multiple lines seperated by βnβ. In this case, the function simulates pressing SHIFT+ENTER for each line. Upon arrival of the interaction, the function waits for the response. Once the response is ready, the function will return the response.
- Parameters:
prompt (str) β The interaction text.
- Returns:
The generated response.
- Return type:
str
- login(username: str, password: str)ο
Performs the login process with the provided username and password.
This function operates on the login page. It finds and clicks the login button, fills in the email and password textboxes
- Parameters:
username (str) β The username to be entered.
password (str) β The password to be entered.
- Returns:
True if login is successful
- Return type:
bool
- regenerate_response()ο
Abstract function to regenerate the responses.
- reset_thread()ο
Function to close the current thread and start new one
- switch_model(model_name: str)ο
Switch the model.
- Parameters:
model_name β str = The name of the model
- Returns:
True on success, False on fail
- Return type:
bool
talkingheads.model_library.piο
Class definition for PI client
- class talkingheads.model_library.pi.PiClient(**kwargs)ο
Bases:
BaseBrowserPiClient class to interact with Pi. It helps you to conncet to https://pi.ai/. Apart from core functionality Pi supports web search. It is not possible to regenerate a response by using Pi
- interact(prompt: str)ο
Sends a prompt and retrieves the response from the ChatGPT system.
This function interacts with the PI. It takes the prompt as input and sends it to the system. The prompt may contain multiple lines separated by βnβ. In this case, the function simulates pressing SHIFT+ENTER for each line. Upon arrival of the interaction, the function waits for the response. Once the response is ready, the function will return the response.
- Parameters:
prompt (str) β The interaction text.
- Returns:
The generated response.
- Return type:
str
- is_ready_to_prompt() boolο
Checks if the Pi is ready to be prompted. The indication for an ongoing message generation process is a disabled send button. The indication for no input is the same disabled button. Therefore we put a dummy dot into the textarea and we are left with the only reason for the button to be disabled, that is, a message being generated.
- Returns:
return if the system is ready to be prompted.
- Return type:
bool
- login(username: str | None = None, password: str | None = None)ο
Performs the login process with the provided username and password. You donβt need to login to use Pi
This function operates on the login page. It finds and clicks the login button, fills in the email and password textboxes
- Parameters:
username (str) β The username to be entered.
password (str) β The password to be entered.
- Returns:
True
- Return type:
bool
- postload_custom_func() Noneο
Pi starts with a welcome message, we should wait until the message to finish.
- regenerate_response()ο
Abstract function to regenerate the responses.
- reset_thread() boolο
Function to close the current thread and start new one
- Returns:
False always, it is not possible to reset in Pi.
- Return type:
bool