INNER CODE UNIT · Python

one_shot

adamyodinsky/TerminalGPT · terminalgpt/main.py:232

def one_shot(ctx, question):
    """One shot question answer."""

    chat_manager: ChatManager = ctx.obj["CHAT"]
    enc_manager: EncryptionManager = ctx.obj["ENC_MNGR"]
    printer: Printer = ctx.obj["PRINTER"]
    conversation_manager: ConversationManager = ctx.obj["CONV_MANAGER"]

    client = OpenAI(api_key=enc_manager.get_api_key())

    chat_manager.client = client
    conversation_manager.client = client

    messages = [config.INIT_SYSTEM_MESSAGE]

    messages.append({"role": "user", "content": question})

    printer.printt("")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…