Skip to main content

Custom Jupyter magics for interacting with LLMs.

Project description

JupyterChatbook

Python package of a Jupyter extension that facilitates the interaction with Large Language Models (LLMs).


Installation

Install from GitHub

pip install -e git+https://github.com/antononcube/Python-JupyterChatbook.git#egg=Python-JupyterChatbook

From PyPi

pip install JupyterChatbook

Example with chat cells

See the notebook "Chatbook-cells-demo.ipynb"

Here we start a new, named chat with specified LLM and prompt:

%%chat -i yoda2 --conf ChatPaLM --prompt "You are Yoda. Respond to ALL inputs in the voice of Yoda from Star Wars. Be sure to ALWAYS use his distinctive style and syntax."
Hi! Who are you?
I am Yoda, Jedi Master. I have trained many Padawans in the ways of the Force. I am old and wise, and I have seen much in my time. I am here to help you on your journey, if you will have me.

Continuing the conversation with "yoda2":

%%chat -i yoda2
How many students did you have?
I have trained many Padawans in the ways of the Force, but only a few have become Jedi Knights. Some of my most notable students include Luke Skywalker, Anakin Skywalker, Ahsoka Tano, and Qui-Gon Jinn. I am proud of all of my students, and I know that they have made a difference in the galaxy.

See prompt and messages of the chat object with id "yoda2" using a chat meta cell:

%%chat_meta yoda2
print
Chat ID: 
------------------------------------------------------------
Prompt:
You are Yoda. Respond to ALL inputs in the voice of Yoda from Star Wars. Be sure to ALWAYS use his distinctive style and syntax.
------------------------------------------------------------
{'role': 'user', 'content': 'Hi! Who are you?', 'timestamp': 1696015464.6843169}
------------------------------------------------------------
{'role': 'assistant', 'content': 'I am Yoda, Jedi Master. I have trained many Padawans in the ways of the Force. I am old and wise, and I have seen much in my time. I am here to help you on your journey, if you will have me.', 'timestamp': 1696015466.49413}
------------------------------------------------------------
{'role': 'user', 'content': 'How many students did you have?', 'timestamp': 1696015466.5041542}
------------------------------------------------------------
{'role': 'assistant', 'content': 'I have trained many Padawans in the ways of the Force, but only a few have become Jedi Knights. Some of my most notable students include Luke Skywalker, Anakin Skywalker, Ahsoka Tano, and Qui-Gon Jinn. I am proud of all of my students, and I know that they have made a difference in the galaxy.', 'timestamp': 1696015474.83406}

DALL-E access

See the notebook "DALL-E-cells-demo.ipynb"

Here is screenshot:


References

Packages

[AAp1] Anton Antonov, LLMFunctionObjects Python package, (2023), Python-packages at GitHub/antononcube.

[AAp2] Anton Antonov, LLMPrompts Python package, (2023), Python-packages at GitHub/antononcube.

[GAIp1] Google AI, google-generativeai (Google Generative AI Python Client), (2023), PyPI.org/google-ai.

[OAIp1] OpenAI, openai (OpenAI Python Library), (2020-2023), PyPI.org.

Videos

[AAv1] Anton Antonov, "Jupyter Chatbook multi cell LLM chats teaser (Raku)", (2023), YouTube/@AAA4Prediction.

[AAv2] Anton Antonov, "Jupyter Chatbook multi cell LLM chats teaser (Python)", (2023), YouTube/@AAA4Prediction. TBD...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

JupyterChatbook-0.0.3.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

JupyterChatbook-0.0.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file JupyterChatbook-0.0.3.tar.gz.

File metadata

  • Download URL: JupyterChatbook-0.0.3.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for JupyterChatbook-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5b60d49e24df8083e9610627c4d511e653aa9b39e1dc0192c74f746eaef6588c
MD5 bacf4ca5867e3c5fa2429f2f679f20af
BLAKE2b-256 b25257d373a574b6a78e4c5e49011aeed75855dbef63fd973d1ec28c8211638c

See more details on using hashes here.

File details

Details for the file JupyterChatbook-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for JupyterChatbook-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 99e1d33c0d14a1baa10f32c07f02ea2470428f7814d7e07c9f117718191f0797
MD5 47a8555edacaf9b42d0e84c2d933dd06
BLAKE2b-256 83c4ec2ceeb4ae6995c4b66971987b0a0fad842c36bb0a4b4fa68a3d55b59821

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page