ipython_gpt package#

Submodules#

ipython_gpt.api_client module#

exception ipython_gpt.api_client.APIClientException[source]#

Bases: Exception

exception ipython_gpt.api_client.APIResponseException(method, path, response_status, response_body)[source]#

Bases: APIClientException

class ipython_gpt.api_client.OpenAIClient(openai_api_key, api_version='v1')[source]#

Bases: object

request(method, path, headers=None, query_params=None, json_body=None)[source]#
exception ipython_gpt.api_client.UnauthorizedAPIException(method, path, response_status, response_body)[source]#

Bases: APIResponseException

ipython_gpt.displays module#

class ipython_gpt.displays.BaseDisplay[source]#

Bases: object

display(results)[source]#
ipython_gpt.displays.DEFAULT_DISPLAY#

alias of ShellDisplay

class ipython_gpt.displays.NotebookDisplay[source]#

Bases: BaseDisplay

TEMPLATE = "<div style='width:60%;margin-left:5%;overflow: scroll;max-height:500px'>\n\n{}\n\n</div>"#
display(results)[source]#
class ipython_gpt.displays.ShellDisplay[source]#

Bases: BaseDisplay

display(results)[source]#
ipython_gpt.displays.get_registered_display()[source]#

ipython_gpt.subcommands module#

class ipython_gpt.subcommands.BaseIPythonGPTCommand(context)[source]#

Bases: object

build_parser()[source]#
execute(line, cell=None)[source]#
parse_args(line)[source]#
class ipython_gpt.subcommands.ChatCommand(context)[source]#

Bases: BaseIPythonGPTCommand

COMMAND_NAME = 'chat'#
class ipython_gpt.subcommands.ChatModelsBrowserCommand(context)[source]#

Bases: BaseIPythonGPTCommand

class ipython_gpt.subcommands.ConfigCommand(context)[source]#

Bases: BaseIPythonGPTCommand

Module contents#

class ipython_gpt.IPythonGPT(**kwargs)[source]#

Bases: Magics

Create a configurable given a config config.

Parameters:
  • config (Config) – If this is empty, default values are used. If config is a Config instance, it will be used to configure the instance.

  • parent (Configurable instance, optional) – The parent Configurable instance of this object.

Notes

Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():

class MyConfigurable(Configurable):
    def __init__(self, config=None):
        super(MyConfigurable, self).__init__(config=config)
        # Then any other code you need to finish initialization.

This ensures that instances will be configured properly.

chat(line, cell)[source]#
chat_config(line)[source]#
chat_models(line)[source]#
magics = {'cell': {'chat': 'chat'}, 'line': {'chat_config': 'chat_config', 'chat_models': 'chat_models'}}#
registered = True#
ipython_gpt.load_ipython_extension(ipython)[source]#