Metadata-Version: 2.4
Name: ipy-yasi
Version: 0.1.2
Summary: DIY alternative to solve it from fast.ai (Yet-Another-SolveIt)
Home-page: https://github.com/Jack-Byte/yasi
Author: Jack-Byte
Author-email: tobi.klings@t-online.de
License: Apache Software License 2.0
Keywords: nbdev jupyter notebook python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ipylab>=1.1.0
Requires-Dist: openai>=1.86.0
Requires-Dist: docx2md>=1.0.2
Provides-Extra: dev
Requires-Dist: ipylab>=1.1.0; extra == "dev"
Requires-Dist: openai>=1.86.0; extra == "dev"
Requires-Dist: docx2md>=1.0.2; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# yasi


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Background

What if you could have a more fluid, interactive conversation with AI?
Enter **Dialog Engineering**, a groundbreaking approach that lets you
construct and edit a dialogue with the AI in real-time.

> Unlike prompt engineering where you’re just creating a single sentence
> or paragraph or whatever, that’s actually part of a whole back and
> forth dialog. All of the previous steps get sent to the AI model as
> well, not just the prompt. And they all greatly influence how it
> responds. And how it responds influences you as to what you then add
> to the dialog. - Jeremy Howard, from [the MAD Podcast
> 34:42](https://www.youtube.com/watch?v=MbHL0uvKYbE&t=34h42s)

Yasi seamlessly integrates Jupyter Notebooks with AI to unlock the
potential of Dialog Engineering. With yasi, you can create, edit, and
refine your conversations with AI. It is a DIY implementation of the -
yet to be released - platform [solveit](https://solveit.fast.ai/) from
answer.ai.

For more information see the following articles:

- [Dialog
  Engineering](https://www.linkedin.com/pulse/dialog-engineering-tobias-klings-jq34f)
- [Introducing Dialog Engineering with
  yasi](https://www.linkedin.com/pulse/boost-your-ai-interactions-tobias-klings-bcnqe)

## Usage

### Installation

Install latest from the GitHub
[repository](https://github.com/Jack-Byte/yasi):

``` sh
$ pip install git+https://github.com/Jack-Byte/yasi.git
```

or from [pypi](https://pypi.org/project/yasi/)

``` sh
$ pip install ipy-yasi
```

### Documentation

Documentation can be found hosted on this GitHub
[repository](https://github.com/Jack-Byte/yasi)’s
[pages](https://Jack-Byte.github.io/yasi/). Additionally you can find
package manager specific guidelines on
[conda](https://anaconda.org/Jack-Byte/yasi) and
[pypi](https://pypi.org/project/yasi/) respectively.

## How to use

You can try it online with Binder
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Jack-Byte/yasi/HEAD?urlpath=%2Fdoc%2Ftree%2F%2Fexamples%2Fmoney_and_kangaroos.ipynb)

Import JupyterChat, set openai_base_url (only if you are not using
Openai itself), and provide your api key directly or as the env variable
`OPENAI_API_KEY`.

``` python
from yasi.core import JupyterChat

jc = JupyterChat(openai_base_url="https://openrouter.ai/api/v1", api_key=None)
```

### Query Openai directly

You can use the `send_query` method to interacte through a code cell
directly. The response will be added as a new markdown cell in your
current notebook.

``` python
jc.send_query('Kia ora, how are you?')
```

Kia ora! I’m doing well, thanks for asking! It’s great to connect with
you and practice some basic Maori phrases. How can I help you today?

### Send Dialoge from your Notebook

JupyterChat is designed to extract messages from your current notebook
and construct a dialoge.

It’s searching for markdown cells that contain the tags

- `#| chat_system` (optional) sets the context for the conversation,
  providing the AI with a “hint” about the type of response expected
- `#| chat_user` your messages
- `#| chat_assistant` the AIs real responses, or the ones that you
  ingest into the dialog

and sends the dialog to the Openai API.

![](files/yasi_demo_roos.gif)
