Skip to content

Commit

Permalink
tweak wording
Browse files Browse the repository at this point in the history
  • Loading branch information
dlqqq committed Feb 12, 2024
1 parent 4f1911c commit 0814b0f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
23 changes: 19 additions & 4 deletions packages/jupyter-ai-module-cookiecutter/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Jupyter AI Module Cookiecutter
# Jupyter AI module cookiecutter

A [cookiecutter](https://github.com/audreyr/cookiecutter) template for creating
a AI module. The AI module constructed from the template serves as a very simple
example that can be extended however you wish.
a Jupyter AI module. A Jupyter AI module is a Python package that registers
additional model providers (containing language and embedding models) and slash
commands for Jupyter AI.

This cookiecutter generates a simple AI module that provides a test model
provider and slash command implementation that can be used in Jupyter AI once
installed. Developers should use this as a template to implement additional
functionality on top of Jupyter AI.

## Usage

Expand All @@ -19,4 +25,13 @@ cd packages/
cookiecutter jupyter-ai-module-cookiecutter
```

Follow the prompts to create a new AI module under `packages/`.
Follow the prompts to create a new AI module under `packages/`.

To install the new AI module locally:

```
cd "<jai-module-root-dir>"
pip install -e "."
```

See the `README.md` under the root directory for more information.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# {{ cookiecutter.python_name }}

This package is a Jupyter AI module named `{{ cookiecutter.python_name }}`
that registers a model provider for the Jupyter AI server extension.
`{{ cookiecutter.python_name }}` is a Jupyter AI module, a package
that registers additional model providers and slash commands for the Jupyter AI
extension.

## Requirements

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from typing import ClassVar, Dict, List
from typing import ClassVar, List
from jupyter_ai import AuthStrategy, BaseProvider, Field

from .llm import TestLLM


class TestProvider(BaseProvider, TestLLM):
"""
A model provider is a class that inherits from 2 classes: 1) the
`BaseProvider` class from `jupyter_ai`, and 2) an LLM class from
`langchain`, i.e. a class inheriting from `LLM` or `BaseChatModel`.
A test model provider implementation for developers to build from. A model
provider inherits from 2 classes: 1) the `BaseProvider` class from
`jupyter_ai`, and 2) an LLM class from `langchain`, i.e. a class inheriting
from `LLM` or `BaseChatModel`.
Any custom model first requires a `langchain` LLM class implementation.
Please import one from `langchain`, or refer to the `langchain` docs for
Expand All @@ -29,8 +30,8 @@ class TestModelProvider(BaseProvider, <langchain-llm-class>):
implementations in `jupyter_ai_magics.providers.py` for further reference.
The provider is made available to Jupyter AI by the entry point declared in
`pyproject.toml`. If this class is renamed, make sure the update the entry
point there as well.
`pyproject.toml`. If this class or parent module is renamed, make sure the
update the entry point there as well.
"""

id: ClassVar[str] = "test-provider"
Expand Down

0 comments on commit 0814b0f

Please sign in to comment.