Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

EdgeGPT

Antonio edited this page Jun 8, 2023 · 12 revisions

EdgeGPT.EdgeGPT

Main.py

Chatbot Objects

class Chatbot()

Combines everything to make it seamless

save_conversation

async def save_conversation(filename: str) -> None

Save the conversation to a file

load_conversation

async def load_conversation(filename: str) -> None

Load the conversation from a file

get_conversation

async def get_conversation() -> dict

Gets the conversation history from conversation_id (requires load_conversation)

ask

async def ask(
    prompt: str,
    wss_link: str = "wss://sydney.bing.com/sydney/ChatHub",
    conversation_style: CONVERSATION_STYLE_TYPE = None,
    webpage_context: str | None = None,
    search_result: bool = False,
    locale: str = guess_locale()) -> dict

Ask a question to the bot Response: { item (dict): messages (list[dict]): adaptiveCards (list[dict]): body (list[dict]): text (str): Response } To get the response, you can do: response["item"]["messages"][1]["adaptiveCards"][0]["body"][0]["text"]

ask_stream

async def ask_stream(
    prompt: str,
    wss_link: str = "wss://sydney.bing.com/sydney/ChatHub",
    conversation_style: CONVERSATION_STYLE_TYPE = None,
    raw: bool = False,
    webpage_context: str | None = None,
    search_result: bool = False,
    locale: str = guess_locale()
) -> Generator[bool, dict | str, None]

Ask a question to the bot

close

async def close() -> None

Close the connection

reset

async def reset() -> None

Reset the conversation

get_input_async

async def get_input_async(session: PromptSession = None,
                          completer: WordCompleter = None) -> str

Multiline input function.

async_main

async def async_main(args: argparse.Namespace) -> None

Main function