Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register, update, and delete aliases #136

Merged
merged 24 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
64c7c6a
Validates registry name
JasonWeill May 2, 2023
877d09a
WIP: Register alias
JasonWeill May 2, 2023
86bb43f
Raises exceptions
JasonWeill May 2, 2023
7be8f50
Refactors, adds delete and update commands
JasonWeill May 2, 2023
5b85286
Additional examples
JasonWeill May 2, 2023
5dcf09d
Update sample notebook
JasonWeill May 2, 2023
737e256
Update docs
JasonWeill May 2, 2023
a97a9db
List aliases
JasonWeill May 2, 2023
15471d6
Refactoring
JasonWeill May 8, 2023
1206bab
Recommends using 'update' command
JasonWeill May 8, 2023
89b2d03
WIP: Gets variable from user namespace, tests whether it's a chain
JasonWeill May 9, 2023
80f40f0
Updates sample workbook, calls custom chain
JasonWeill May 9, 2023
3384e3b
Updates user docs for aliases
JasonWeill May 9, 2023
fff7af6
Edits sample notebook
JasonWeill May 9, 2023
ce2e726
Alias list in text display, updates messaging
JasonWeill May 9, 2023
0bfbe84
Updates sample workbook
JasonWeill May 9, 2023
9e7a455
Updates sample notebook, parsers to use click
JasonWeill May 31, 2023
4726d17
Additional cleanup
JasonWeill May 31, 2023
0933126
Updates sample notebook, removes unahppy case
JasonWeill Jun 5, 2023
306955b
Fix error from rebase, updates sample notebook
JasonWeill Jun 6, 2023
9f746cd
Fixed error when --format is used
3coins Jun 6, 2023
59f5b84
Update docs/source/users/index.md
JasonWeill Jun 6, 2023
350ce12
Update docs/source/users/index.md
JasonWeill Jun 6, 2023
b5a74f4
Wraps ValueError exceptions to not print stack trace
JasonWeill Jun 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions docs/source/users/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,3 +548,56 @@ As a shortcut for explaining errors, you can use the `%ai error` command, which
%ai error anthropic:claude-v1.2
```

### Creating and managing aliases

You can create an alias for a model using the `%ai register` command. For example, the command:

```
%ai register claude anthropic:claude-v1.2
```

will register the alias `claude` as pointing to the `anthropic` provider's `claude-v1.2` model. You can then use this alias as you would use any other model name:

```
%%ai claude
Write a poem about C++.
```

You can also define a custom LangChain chain:

```
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate
from langchain.llms import OpenAI

llm = OpenAI(temperature=0.9)
prompt = PromptTemplate(
input_variables=["product"],
template="What is a good name for a company that makes {product}?",
)
chain = LLMChain(llm=llm, prompt=prompt)
```

… and then use `%ai register` to give it a name:

```
%ai register companyname chain
JasonWeill marked this conversation as resolved.
Show resolved Hide resolved
```

You can change an alias's target using the `%ai update` command:

```
%ai update claude anthropic:claude-instant-v1.0
```

You can delete an alias using the `%ai delete` command:

```
%ai delete claude
```

You can see a list of all aliases by running the `%ai list` command.

Aliases' names can contain ASCII letters (uppercase and lowercase), numbers, hyphens, underscores, and periods. They may not contain colons. They may also not override built-in commands — run `%ai help` for a list of these commands.

Aliases must refer to models or `LLMChain` objects; they cannot refer to other aliases.
Loading