Skip to content

Commit

Permalink
mv domain
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Jun 24, 2024
1 parent 03eb3ae commit 854e256
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 31 deletions.
2 changes: 1 addition & 1 deletion 00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"id": "c47b5d38",
"metadata": {},
"source": [
"This is the 'literate' source code for Claudette. You can view the fully rendered version of the notebook [here](https://answerdotai.github.io/claudette/core.html), or you can clone the git repo and run the [interactive notebook](https://github.com/AnswerDotAI/claudette/blob/main/00_core.ipynb) in Jupyter. The notebook is converted the [Python module claudette/core.py](https://github.com/AnswerDotAI/claudette/blob/main/claudette/core.py) using [nbdev](https://nbdev.fast.ai/). The goal of this source code is to both create the Python module, and also to teach the reader *how* it is created, without assuming much existing knowledge about Claude's API.\n",
"This is the 'literate' source code for Claudette. You can view the fully rendered version of the notebook [here](https://claudette.answer.ai/core.html), or you can clone the git repo and run the [interactive notebook](https://github.com/AnswerDotAI/claudette/blob/main/00_core.ipynb) in Jupyter. The notebook is converted the [Python module claudette/core.py](https://github.com/AnswerDotAI/claudette/blob/main/claudette/core.py) using [nbdev](https://nbdev.fast.ai/). The goal of this source code is to both create the Python module, and also to teach the reader *how* it is created, without assuming much existing knowledge about Claude's API.\n",
"\n",
"Most of the time you'll see that we write some source code *first*, and then a description or discussion of it *afterwards*."
]
Expand Down
41 changes: 18 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

> **NB**: If you are reading this in GitHub’s readme, we recommend you
> instead read the much more nicely formatted [documentation
> format](https://answerdotai.github.io/claudette/) of this tutorial.
> format](https://claudette.answer.ai/) of this tutorial.
*Claudette* is a wrapper for Anthropic’s [Python
SDK](https://github.com/anthropics/anthropic-sdk-python).
Expand All @@ -17,8 +17,8 @@ to do a lot of stuff manually. That’s a lot of extra work and
boilerplate! Claudette automates pretty much everything that can be
automated, whilst providing full control. Amongst the features provided:

- A [`Chat`](https://AnswerDotAI.github.io/claudette/core.html#chat)
class that creates stateful dialogs
- A [`Chat`](https://claudette.answer.ai/core.html#chat) class that
creates stateful dialogs
- Support for *prefill*, which tells Claude what to use as the first few
words of its response
- Convenient image support
Expand All @@ -33,11 +33,11 @@ Notebook which includes callout notes and tips, HTML tables and images,
detailed explanations, and teaches *how* and *why* the code is written
the way it is. Even if you’ve never used the Anthropic Python SDK or
Claude API before, you should be able to read the source code. Click
[Claudette’s Source](https://answerdotai.github.io/claudette/core.html)
to read it, or clone the git repo and execute the notebook yourself to
see every step of the creation process in action. The tutorial below
includes links to API details which will take you to relevant parts of
the source. The reason this project is a new kind of literal program is
[Claudette’s Source](https://claudette.answer.ai/core.html) to read it,
or clone the git repo and execute the notebook yourself to see every
step of the creation process in action. The tutorial below includes
links to API details which will take you to relevant parts of the
source. The reason this project is a new kind of literal program is
because we take seriously Knuth’s call to action, that we have a “*moral
commitment*” to never write an “*illiterate program*” – and so we have a
commitment to making literate programming and easy and pleasant
Expand Down Expand Up @@ -104,8 +104,8 @@ model = models[1]
## Chat

The main interface to Claudette is the
[`Chat`](https://AnswerDotAI.github.io/claudette/core.html#chat) class,
which provides a stateful interface to Claude:
[`Chat`](https://claudette.answer.ai/core.html#chat) class, which
provides a stateful interface to Claude:

``` python
chat = Chat(model, sp="""You are a helpful and concise assistant.""")
Expand Down Expand Up @@ -237,9 +237,8 @@ pr
'What is 604542+6458932?'

To use tools, pass a list of them to
[`Chat`](https://AnswerDotAI.github.io/claudette/core.html#chat), and to
force it to always answer using a tool, set `tool_choice` to that
function name:
[`Chat`](https://claudette.answer.ai/core.html#chat), and to force it to
always answer using a tool, set `tool_choice` to that function name:

``` python
chat = Chat(model, sp=sp, tools=[sums], tool_choice='sums')
Expand Down Expand Up @@ -310,7 +309,7 @@ chat.use
In: 916; Out: 88; Total: 1004

We can do everything needed to use tools in a single step, by using
[`Chat.toolloop`](https://AnswerDotAI.github.io/claudette/toolloop.html#chat.toolloop).
[`Chat.toolloop`](https://claudette.answer.ai/toolloop.html#chat.toolloop).
This can even call multiple tools as needed solve a problem. For
example, let’s define a tool to handle multiplication:

Expand Down Expand Up @@ -382,8 +381,7 @@ display.Image(filename=fn, width=200)

![](index_files/figure-commonmark/cell-21-output-1.jpeg)

We create a
[`Chat`](https://AnswerDotAI.github.io/claudette/core.html#chat) object
We create a [`Chat`](https://claudette.answer.ai/core.html#chat) object
as before:

``` python
Expand Down Expand Up @@ -582,8 +580,7 @@ models_aws
'anthropic.claude-3-5-sonnet-20240620-v1:0')

To use them, call `AnthropicBedrock` with your access details, and pass
that to
[`Client`](https://AnswerDotAI.github.io/claudette/core.html#client):
that to [`Client`](https://claudette.answer.ai/core.html#client):

``` python
from anthropic import AnthropicBedrock
Expand All @@ -597,9 +594,8 @@ ab = AnthropicBedrock(
client = Client(models_aws[-1], ab)
```

Now create your
[`Chat`](https://AnswerDotAI.github.io/claudette/core.html#chat) object
passing this client to the `cli` parameter – and from then on,
Now create your [`Chat`](https://claudette.answer.ai/core.html#chat)
object passing this client to the `cli` parameter – and from then on,
everything is identical to the previous examples.

``` python
Expand Down Expand Up @@ -640,8 +636,7 @@ models_goog
'claude-3-5-sonnet@20240620')

To use them, call `AnthropicVertex` with your access details, and pass
that to
[`Client`](https://AnswerDotAI.github.io/claudette/core.html#client):
that to [`Client`](https://claudette.answer.ai/core.html#client):

``` python
from anthropic import AnthropicVertex
Expand Down
30 changes: 28 additions & 2 deletions claudette/_modidx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Autogenerated by nbdev

d = { 'settings': { 'branch': 'main',
'doc_baseurl': '/claudette',
'doc_host': 'https://AnswerDotAI.github.io',
'doc_baseurl': '/',
'doc_host': 'https://claudette.answer.ai',
'git_url': 'https://github.com/AnswerDotAI/claudette',
'lib_path': 'claudette'},
'syms': { 'claudette.core': { 'claudette.core.Chat': ('core.html#chat', 'claudette/core.py'),
Expand Down Expand Up @@ -31,4 +31,30 @@
'claudette.core.mk_toolres': ('core.html#mk_toolres', 'claudette/core.py'),
'claudette.core.text_msg': ('core.html#text_msg', 'claudette/core.py'),
'claudette.core.usage': ('core.html#usage', 'claudette/core.py')},
'claudette.core2': { 'claudette.core2.Chat': ('core.html#chat', 'claudette/core2.py'),
'claudette.core2.Chat.__call__': ('core.html#chat.__call__', 'claudette/core2.py'),
'claudette.core2.Chat.__init__': ('core.html#chat.__init__', 'claudette/core2.py'),
'claudette.core2.Chat._stream': ('core.html#chat._stream', 'claudette/core2.py'),
'claudette.core2.Chat.use': ('core.html#chat.use', 'claudette/core2.py'),
'claudette.core2.Client': ('core.html#client', 'claudette/core2.py'),
'claudette.core2.Client.__call__': ('core.html#client.__call__', 'claudette/core2.py'),
'claudette.core2.Client.__init__': ('core.html#client.__init__', 'claudette/core2.py'),
'claudette.core2.Client._r': ('core.html#client._r', 'claudette/core2.py'),
'claudette.core2.Client._stream': ('core.html#client._stream', 'claudette/core2.py'),
'claudette.core2.Message._repr_markdown_': ('core.html#message._repr_markdown_', 'claudette/core2.py'),
'claudette.core2.Usage.__add__': ('core.html#usage.__add__', 'claudette/core2.py'),
'claudette.core2.Usage.__repr__': ('core.html#usage.__repr__', 'claudette/core2.py'),
'claudette.core2.Usage.total': ('core.html#usage.total', 'claudette/core2.py'),
'claudette.core2._mk_content': ('core.html#_mk_content', 'claudette/core2.py'),
'claudette.core2._mk_ns': ('core.html#_mk_ns', 'claudette/core2.py'),
'claudette.core2.call_func': ('core.html#call_func', 'claudette/core2.py'),
'claudette.core2.contents': ('core.html#contents', 'claudette/core2.py'),
'claudette.core2.find_block': ('core.html#find_block', 'claudette/core2.py'),
'claudette.core2.img_msg': ('core.html#img_msg', 'claudette/core2.py'),
'claudette.core2.mk_msg': ('core.html#mk_msg', 'claudette/core2.py'),
'claudette.core2.mk_msgs': ('core.html#mk_msgs', 'claudette/core2.py'),
'claudette.core2.mk_tool_choice': ('core.html#mk_tool_choice', 'claudette/core2.py'),
'claudette.core2.mk_toolres': ('core.html#mk_toolres', 'claudette/core2.py'),
'claudette.core2.text_msg': ('core.html#text_msg', 'claudette/core2.py'),
'claudette.core2.usage': ('core.html#usage', 'claudette/core2.py')},
'claudette.toolloop': {'claudette.toolloop.Chat.toolloop': ('toolloop.html#chat.toolloop', 'claudette/toolloop.py')}}}
4 changes: 2 additions & 2 deletions index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"id": "576899c4",
"metadata": {},
"source": [
"> **NB**: If you are reading this in GitHub's readme, we recommend you instead read the much more nicely formatted [documentation format](https://answerdotai.github.io/claudette/) of this tutorial.\n",
"> **NB**: If you are reading this in GitHub's readme, we recommend you instead read the much more nicely formatted [documentation format](https://claudette.answer.ai/) of this tutorial.\n",
"\n",
"*Claudette* is a wrapper for Anthropic's [Python SDK](https://github.com/anthropics/anthropic-sdk-python).\n",
"\n",
Expand All @@ -50,7 +50,7 @@
"\n",
"You'll need to set the `ANTHROPIC_API_KEY` environment variable to the key provided to you by Anthropic in order to use this library.\n",
"\n",
"Note that this library is the first ever \"literate nbdev\" project. That means that the actual source code for the library is a rendered Jupyter Notebook which includes callout notes and tips, HTML tables and images, detailed explanations, and teaches *how* and *why* the code is written the way it is. Even if you've never used the Anthropic Python SDK or Claude API before, you should be able to read the source code. Click [Claudette's Source](https://answerdotai.github.io/claudette/core.html) to read it, or clone the git repo and execute the notebook yourself to see every step of the creation process in action. The tutorial below includes links to API details which will take you to relevant parts of the source. The reason this project is a new kind of literal program is because we take seriously Knuth's call to action, that we have a \"*moral commitment*\" to never write an \"*illiterate program*\" -- and so we have a commitment to making literate programming and easy and pleasant experience. (For more on this, see [this talk](https://www.youtube.com/watch?v=rX1yGxJijsI) from Hamel Husain.)\n",
"Note that this library is the first ever \"literate nbdev\" project. That means that the actual source code for the library is a rendered Jupyter Notebook which includes callout notes and tips, HTML tables and images, detailed explanations, and teaches *how* and *why* the code is written the way it is. Even if you've never used the Anthropic Python SDK or Claude API before, you should be able to read the source code. Click [Claudette's Source](https://claudette.answer.ai/core.html) to read it, or clone the git repo and execute the notebook yourself to see every step of the creation process in action. The tutorial below includes links to API details which will take you to relevant parts of the source. The reason this project is a new kind of literal program is because we take seriously Knuth's call to action, that we have a \"*moral commitment*\" to never write an \"*illiterate program*\" -- and so we have a commitment to making literate programming and easy and pleasant experience. (For more on this, see [this talk](https://www.youtube.com/watch?v=rX1yGxJijsI) from Hamel Husain.)\n",
"\n",
"> \"*Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a **computer** what to do, let us concentrate rather on explaining to **human beings** what we want a computer to do.*\" Donald E. Knuth, [Literate Programming](https://www.cs.tufts.edu/~nr/cs257/archive/literate-programming/01-knuth-lp.pdf) (1984)"
]
Expand Down
2 changes: 1 addition & 1 deletion nbdev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project:

website:
title: "claudette"
site-url: "https://AnswerDotAI.github.io/claudette"
site-url: "https://claudette.answer.ai/"
description: "Claudette is Claude's friend"
repo-branch: main
repo-url: "https://github.com/AnswerDotAI/claudette"
4 changes: 2 additions & 2 deletions settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ tst_flags = notest
put_version_in_init = True
branch = main
custom_sidebar = False
doc_host = https://AnswerDotAI.github.io
doc_baseurl = /claudette
doc_host = https://claudette.answer.ai
doc_baseurl = /
git_url = https://github.com/AnswerDotAI/claudette
title = claudette
audience = Developers
Expand Down

0 comments on commit 854e256

Please sign in to comment.