radekosmulski / ask_ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ask_ai

A simple library for talking to ChatGPT from within Jupyter Notebook.

Motivation: Don’t fear ChatGPT taking your job. Fear a person using ChatGPT taking your job.

Of course, this is a sensationalized statement. But it very succinctly gets at something deep and important – using LLMs in your work can unlock massive productivity gains. I do not know of a better way for me to start using these tools than to bring them closer to where I work, which is Jupyter Notebooks.

Also, I really hate the “typewriter effect” where you are fed a few words at a time through the ChatGPT UI. I’d much rather have the full reply I can scan in a couple of seconds.

Install

  1. pip install git+https://github.com/radekosmulski/ask_ai.git
  2. Set the environment variable OPENAI_API_KEY to your OpenAI API key.
  3. Load the magics in your jupyter notebook: %load_ext ask_ai.magics

How to use

Use %%ai_ask to start a new conversation, and %%ai_continue to continue an existing conversation.

%%ai_ask starts a conversation with new (blank) context.

As long as you using %%ai_continue all (or the most recent) previous messages will be forwarded as context. This can be helpful if your question is related to what you have been discussing so far. In other cases, it is faster and cheaper to use %%ai_ask as fewer tokens are used.

About

License:Apache License 2.0


Languages

Language:Jupyter Notebook 55.4%Language:Python 42.2%Language:CSS 2.4%