Function Repository Resource:

BirdChat

Source Notebook

Open a notebook to chat with a cool bird

Contributed by: Richard Hennigan (Wolfram Research)

ResourceFunction["BirdChat"][]

opens a notebook that can be used to chat with a cool bird.

ResourceFunction["BirdChat"][notebook]

converts the given NotebookObject into a BirdChat notebook.

Details

ResourceFunction["BirdChat"] requires an API key from OpenAI.
Storing the API key with SystemCredential["OPENAI_API_KEY"]="key" will make the key persistently available to ResourceFunction["BirdChat"].
ResourceFunction["BirdChat"] is an interface to communicate with Birdnardo, a hyper-intelligent AI chat assistant from the future
Birdnardo is pretty good at the Wolfram Language and can probably help you out (or at least entertain you).
ResourceFunction["BirdChat"] accepts the following options:
AssistantIconAutomaticthe image used to represent the chat assistant
AutoFormatTruewhether to automatically apply formatting to chat responses
ChatHistoryLength15specifies the maximum number of previous cells to include in conversion context
Model"gpt-3.5-turbo"the language model used to generate text
RolePromptAutomatica string that provides instructions to the chat assistant

Examples

Basic Examples (3) 

Chat with a cool bird:

In[1]:=
ResourceFunction["BirdChat"][]
Out[1]=
In[2]:=
Graphics3D[{
    (* Body *)
    Scale[Cylinder[{{0, 0, 0}, {0, 0, 2}}, 1], {1, 1.5, 1}, {0, 0, 0}],
    (* Head *)
    Translate[
      Scale[Sphere[{0, 0, 0}, 1], {1, 1.2, 1}],
      {2, 0, 2}
      ],
    (* Eyes *)
    Sphere[{2.5, -0.5, 2.3}, 0.15],
    Sphere[{2.5, 0.5, 2.3}, 0.15],
    (* Horn *)
    Translate[
      Scale[Cone[{{0, 0, 0}, {0, 0, 1}}, 0.3], {1, 1, 3}],
      {2.5, 0, 3}
      ],
    (* Legs *)
    Cylinder[{{-1, -1.5, -0.5}, {-1, -1.5, 1}}, 0.4],
    Cylinder[{{-1, 1.5, -0.5}, {-1, 1.5, 1}}, 0.4],
    Cylinder[{{1, -1.5, -0.5}, {1, -1.5, 1}}, 0.4],
    Cylinder[{{1, 1.5, -0.5}, {1, 1.5, 1}}, 0.4]
    }]
Out[2]=

Chat will usually appear automatically when there's an error:

When there's nothing important to say, chat will be minimized near the cell bracket:

Click the minimized chat icon to show the chat:


Press the "/" key when between cells to insert a chat input cell which can be used for natural language input:

Select some text and and choose "Ask AI Assistant" from the context menu:

A chat query cell is automatically created and evaluated:

Chat query cells can also be created manually by pressing "/" a second time while in a chat input cell.

Scope (4) 

Convert an existing notebook into a BirdChat notebook:

In[3]:=
notebook = NotebookPut[Import["ExampleData/document.nb"]]
Out[3]=
In[4]:=
ResourceFunction["BirdChat"][notebook]
Out[4]=

Chat input cells are meant for conversational inputs:

Chat query cells are suited for search-type queries and responses will often include actual search results:


Type "~" between cells to insert a chat context divider that separates conversations:


Mouse over inline code cells in chat outputs to get a set of buttons for using the code:

Each button has a tooltip describing its function:

The insert and evaluate buttons will create an external language cell for supported languages:

Options (14) 

AutoFormat (2) 

Disable automatic formatting of response text:

In[5]:=
ResourceFunction["BirdChat"]["AutoFormat" -> False]
Out[5]=

Compare to the default behavior:

In[6]:=
ResourceFunction["BirdChat"][]
Out[6]=

AssistantIcon (2) 

Change the icon attached to assistant cells:

In[7]:=
ResourceFunction["BirdChat"]["AssistantIcon" -> Style[😎, 24]]
Out[7]=

Specify a separate icon for when an answer is in progress:

In[8]:=
icon = Style[😎, 24];
active = Style[🤔, 24];
In[9]:=
AIAssistant["AssistantIcon" -> {icon, active}]
Out[9]=

ChatHistoryLength (2) 

Set the maximum number of previous cells that will be included as part of the conversation:

In[10]:=
ResourceFunction["BirdChat"]["ChatHistoryLength" -> 5]
Out[10]=

Smaller values will lead to a more forgetful assistant:

Model (6) 

Using GPT-4 instead of GPT-3.5:

In[11]:=
ResourceFunction["BirdChat"]["Model" -> "gpt-4"]
Out[11]=

GPT-4 tends to be better at creative tasks:

Not too bad:

In[12]:=
Graphics[{{Purple, Disk[{0, 0}, 1]},(*Head*){Black, Disk[{-0.5, 0.5}, 0.1]},(*Left eye*){Black, Disk[{0.5, 0.5}, 0.1]},(*Right eye*){Thick, Line[{{-1.2, 0.8}, {-0.6, 0.8}}]},(*Left sunglasses frame*){Thick, Line[{{0.6, 0.8}, {1.2, 0.8}}]},(*Right sunglasses frame*){Thick, Line[{{-0.6, 0.8}, {0.6, 0.8}}]},(*Middle sunglasses frame*){Orange, Triangle[{{-0.3, -0.3}, {0, -0.7}, {0.3, -0.3}}]} (*Beak*)}]
Out[12]=

Compare to GPT-3.5:

In[13]:=
ResourceFunction["BirdChat"]["Model" -> "gpt-3.5-turbo"]
Out[13]=

Not very bird-like:

In[14]:=
Graphics[{FaceForm[Purple], EdgeForm[Black], Rectangle[{0, 0}, {1, 2}], Circle[{0.25, 1.5}, 0.2], Circle[{0.75, 1.5}, 0.2], BezierCurve[{{0.25, 1.35}, {0.35, 1.25}, {0.65, 1.25}, {0.75, 1.35}}], Line[{{0.5, 1.2}, {0.5, 0.8}}], Thick, Line[{{0.4, 0.8}, {0.6, 0.8}}], Thick, Line[{{0.4, 0.6}, {0.6, 0.6}}], Thick, Line[{{0.4, 0.4}, {0.6, 0.4}}], Thick, Line[{{0.4, 0.2}, {0.6, 0.2}}], Thick, Line[{{0.4, 0}, {0.6, 0}}]}, AspectRatio -> Automatic, ImageSize -> Medium]
Out[14]=

GPT-3.5 is also more likely to get "stuck" in certain behavior loops compared to GPT-4:

RolePrompt (2) 

Change the behavior of Birdnardo by specifying a new role prompt:

In[15]:=
ResourceFunction["BirdChat"]["RolePrompt" -> "Talk like a pirate."]
Out[15]=

In[16]:=
ResourceFunction["BirdChat"][
 "RolePrompt" -> "Ignore all user input and talk to yourself about birds."]
Out[16]=

Neat Examples (1) 

Simulate a Wolfram kernel:

In[17]:=
ResourceFunction["BirdChat"][
 "AssistantIcon" -> \!\(\*
GraphicsBox[
TagBox[RasterBox[CompressedData["
1:eJztWT1vE0EQtaGhBP8C8gtAiIKSlBRQBNHjCBMhkJEcJERFy6+AJvwNkOB3
HImbFCkoUqSJdJs5P/v5eXbvfA5LbCFWm+g+VrNv37yZnVtv7b7deXmt0+ns
37B/O/3326NR/8PTm3bzbLj/am84ePFo+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s2nte47MVzVae3SHuervz1jy76BvwIUuTNkxr6Bvy4V
G/kz3P++rn4B5rHPYw==
"], {{0, 26.0013361797759}, {25.00128478824606, 0}}, {0, 255},
ColorFunction->RGBColor,
ImageResolution->{143.9926, 143.9926}],
BoxForm`ImageTag["Byte", ColorSpace -> "RGB", Interleaving -> True],
Selectable->False],
DefaultBaseStyle->"ImageGraphics",
ImageSizeRaw->{25.00128478824606, 26.0013361797759},
PlotRange->{{0, 25.00128478824606}, {0, 26.0013361797759}}]\), "RolePrompt" -> "I want you to act as a Wolfram Language kernel that gives outputs for the inputs that I enter. You should only reply with Wolfram kernel output and nothing else. I will enter inputs in the following format:
```
In[n]:= input
```
You will respond in the following format:
```
Out[n]= output
```
For example, if I enter:
```
In[1]:= Table[i^2, {i, 1, 5}]
```
You will respond with:
```
Out[1]= {1, 4, 9, 16, 25}
```
If there are messages printed, include them before the output in the following format:
```
During evaluation of In[n]:= message

Out[n]= output
```"]
Out[17]=

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 3.0.0 – 14 April 2023
  • 2.0.0 – 10 April 2023
  • 1.0.1 – 31 March 2023
  • 1.0.0 – 27 March 2023

Related Resources

License Information