Skip to content

Commit

Permalink
Merge pull request #818 from WolframResearch/main
Browse files Browse the repository at this point in the history
Release v1.5.1
  • Loading branch information
rhennigan authored Oct 7, 2024
2 parents f6143fb + 72bf74b commit 3926b64
Show file tree
Hide file tree
Showing 108 changed files with 29,805 additions and 2,903 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.jsonl filter=lfs diff=lfs merge=lfs -text
4 changes: 4 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:
env:
RESOURCE_PUBLISHER_TOKEN: ${{ secrets.RESOURCE_PUBLISHER_TOKEN }}
WOLFRAMSCRIPT_ENTITLEMENTID: ${{ secrets.WOLFRAMSCRIPT_ENTITLEMENTID }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

jobs:

Expand Down Expand Up @@ -42,5 +43,8 @@ jobs:
with:
path: ${{ env.PACLET_BUILD_DIR }}

- name: InstallTestDependencies
run: wolframscript -f Scripts/InstallTestDependencies.wls

- name: Test
run: wolframscript -f Scripts/TestPaclet.wls
7 changes: 7 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:
env:
RESOURCE_PUBLISHER_TOKEN: ${{ secrets.RESOURCE_PUBLISHER_TOKEN }}
WOLFRAMSCRIPT_ENTITLEMENTID: ${{ secrets.WOLFRAMSCRIPT_ENTITLEMENTID }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

jobs:

Expand All @@ -37,6 +38,9 @@ jobs:
- name: Build
run: wolframscript -f Scripts/BuildPaclet.wls

- name: InstallTestDependencies
run: wolframscript -f Scripts/InstallTestDependencies.wls

- name: Test
run: wolframscript -f Scripts/TestPaclet.wls

Expand Down Expand Up @@ -98,6 +102,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Unformat
run: wolframscript -f Scripts/UnformatFiles.wls

- name: BuildMX
run: wolframscript -f Scripts/BuildMX.wls

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build
.DS_Store
Assets/VectorDatabases/**/*.usearch
Assets/VectorDatabases/**/*.wxf
build
Source/Chatbook/64Bit/Chatbook.mx
Binary file modified Assets/DisplayFunctions.wxf
Binary file not shown.
Binary file added Assets/Tokenizers/claude.wxf
Binary file not shown.
Binary file added Assets/Tokenizers/gpt-2.wxf
Binary file not shown.
Binary file added Assets/Tokenizers/gpt-3.5.wxf
Binary file not shown.
Binary file added Assets/Tokenizers/gpt-4.wxf
Binary file not shown.
Binary file added Assets/Tokenizers/gpt-4o-text.wxf
Binary file not shown.
61 changes: 61 additions & 0 deletions Developer/CacheTokenizers.wl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
(* This is used to backport tokenizers from later versions of WL to 13.3 so they can be included in the MX build. *)

(* ::Section::Closed:: *)
(*Package Header*)
BeginPackage[ "Wolfram`ChatbookDeveloper`" ];

`CacheTokenizers;

Begin[ "`Private`" ];

PacletInstall[ "Wolfram/LLMFunctions" ];
Block[ { $ContextPath }, Get[ "Wolfram`LLMFunctions`" ] ];

Get[ "Wolfram`Chatbook`" ];
Needs[ "Wolfram`Chatbook`Common`" ];
Needs[ "Developer`" -> None ];

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Paths*)
$pacletDirectory = DirectoryName[ $InputFileName, 2 ];
$tokenizerDirectory = FileNameJoin @ { $pacletDirectory, "Assets", "Tokenizers" };

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Aliases*)
ensureDirectory = GeneralUtilities`EnsureDirectory;
readWXFFile = Developer`ReadWXFFile;
writeWXFFile = Developer`WriteWXFFile;

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*CacheTokenizers*)
CacheTokenizers // ClearAll;

CacheTokenizers[ ] :=
Enclose @ Module[ { tokenizers, exported },
tokenizers = ConfirmBy[ Select[ cachedTokenizer @ All, MatchQ[ _NetEncoder ] ], AssociationQ, "Tokenizers" ];
ConfirmAssert[ Length @ tokenizers > 0, "LengthCheck" ];
exported = ConfirmBy[ Association @ KeyValueMap[ exportTokenizer, tokenizers ], AssociationQ, "Exported" ];
exported
];

(* ::**************************************************************************************************************:: *)
(* ::Subsection::Closed:: *)
(*exportTokenizer*)
exportTokenizer // ClearAll;
exportTokenizer[ name_String, tokenizer_NetEncoder ] :=
Enclose @ Module[ { dir, file, exported },
dir = ConfirmBy[ ensureDirectory @ $tokenizerDirectory, DirectoryQ, "Directory" ];
file = FileNameJoin @ { dir, name <> ".wxf" };
exported = ConfirmBy[ writeWXFFile[ file, tokenizer, PerformanceGoal -> "Size" ], FileExistsQ, "Export" ];
ConfirmMatch[ readWXFFile[ exported ][ "Hello world" ], { __Integer }, "Verification" ];
name -> exported
];

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Package Footer*)
End[ ];
EndPackage[ ];
Binary file not shown.
72 changes: 48 additions & 24 deletions Developer/Resources/Styles.wl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Cell[
|>,

ComponentwiseContextMenu -> <|
"CellBracket" -> contextMenu[ $askMenuItem, $excludeMenuItem, Delimiter, "CellBracket" ],
"CellGroup" -> contextMenu[ $excludeMenuItem, Delimiter, "CellGroup" ],
"CellRange" -> contextMenu[ $excludeMenuItem, Delimiter, "CellRange" ]
"CellBracket" -> contextMenu[ { $askMenuItem, $excludeMenuItem, Delimiter }, "CellBracket" ],
"CellGroup" -> contextMenu[ { $excludeMenuItem, Delimiter }, "CellGroup" ],
"CellRange" -> contextMenu[ { $excludeMenuItem, Delimiter }, "CellRange" ]
|>,

PrivateCellOptions -> {
Expand All @@ -59,7 +59,7 @@ Cell[

Cell[
StyleData[ "Text" ],
ContextMenu -> contextMenu[ $askMenuItem, Delimiter, "Text" ]
ContextMenu -> contextMenu[ { $askMenuItem, Delimiter }, "Text" ]
]


Expand All @@ -77,7 +77,7 @@ Cell[
"*" -> "Item",
">" -> "ExternalLanguageDefault"
},
ContextMenu -> contextMenu[ $askMenuItem, Delimiter, "Input" ],
ContextMenu -> contextMenu[ { $askMenuItem, Delimiter }, "Input" ],
CellEpilog :> With[ { $CellContext`cell = (FinishDynamic[ ]; EvaluationCell[ ]) },
Quiet @ Needs[ "Wolfram`Chatbook`" -> None ];
Symbol[ "Wolfram`Chatbook`ChatbookAction" ][ "AIAutoAssist", $CellContext`cell ]
Expand All @@ -92,7 +92,7 @@ Cell[

Cell[
StyleData[ "Output" ],
ContextMenu -> contextMenu[ $askMenuItem, Delimiter, "Output" ],
ContextMenu -> contextMenu[ { $askMenuItem, Delimiter }, "Output" ],
CellTrayWidgets -> <| "GearMenu" -> <| "Condition" -> False |> |>
]

Expand Down Expand Up @@ -334,7 +334,7 @@ Cell[
TaggingRules -> <| "ChatNotebookSettings" -> <| |> |>,
CellTrayWidgets -> <|
"ChatWidget" -> <| "Visible" -> False |>,
"ChatFeedback" -> <| "Content" -> Cell[ BoxData @ ToBoxes @ $feedbackButtons, "ChatFeedback" ] |>
"ChatFeedback" -> <| "Content" -> Cell[ BoxData @ ToBoxes @ $feedbackButtonsV, "ChatFeedback" ] |>
|>,
menuInitializer[ "ChatOutput", RGBColor[ "#ecf0f5" ] ]
]
Expand Down Expand Up @@ -611,7 +611,8 @@ Cell[
BaselinePosition -> Scaled[ 0.275 ],
FrameMargins -> { { 3, 3 }, { 2, 2 } },
FrameStyle -> Directive[ AbsoluteThickness[ 1 ], GrayLevel[ 0.92941 ] ],
ImageMargins -> { { 0, 0 }, { 0, 0 } }
ImageMargins -> { { 0, 0 }, { 0, 0 } },
BaseStyle -> { "InlineCode", AutoSpacing -> False, AutoMultiplicationSymbol -> False }
]
}
]
Expand Down Expand Up @@ -1084,13 +1085,18 @@ Cell[
Cell[
StyleData[ "UserMessageBox" ],
TemplateBoxOptions -> {
DisplayFunction -> Function @ Evaluate @ FrameBox[
Cell[ #, "Text", Background -> None ],
Background -> RGBColor[ "#edf4fc" ],
FrameMargins -> 8,
FrameStyle -> RGBColor[ "#a3c9f2" ],
RoundingRadius -> 10,
StripOnInput -> False
DisplayFunction -> Function @ Evaluate @ PaneBox[
FrameBox[
#,
BaseStyle -> { "Text", Editable -> False, Selectable -> False },
Background -> RGBColor[ "#edf4fc" ],
FrameMargins -> 8,
FrameStyle -> RGBColor[ "#a3c9f2" ],
RoundingRadius -> 10,
StripOnInput -> False
],
Alignment -> Right,
ImageSize -> { Full, Automatic }
]
}
]
Expand All @@ -1103,20 +1109,38 @@ Cell[
Cell[
StyleData[ "AssistantMessageBox" ],
TemplateBoxOptions -> {
DisplayFunction -> Function @ Evaluate @ FrameBox[
#,
BaseStyle -> "Text",
Background -> RGBColor[ "#fcfdff" ],
FrameMargins -> 8,
FrameStyle -> RGBColor[ "#c9ccd0" ],
ImageSize -> { Scaled[ 1 ], Automatic },
RoundingRadius -> 10,
StripOnInput -> False
DisplayFunction -> Function @ Evaluate @ TagBox[
FrameBox[
#,
BaseStyle -> { "Text", Editable -> False, Selectable -> False },
Background -> RGBColor[ "#fcfdff" ],
FrameMargins -> 8,
FrameStyle -> RGBColor[ "#c9ccd0" ],
ImageSize -> { Scaled[ 1 ], Automatic },
RoundingRadius -> 10,
StripOnInput -> False
],
EventHandlerTag @ {
"MouseEntered" :>
With[ { cell = EvaluationCell[ ] },
Quiet @ Needs[ "Wolfram`Chatbook`" -> None ];
Symbol[ "Wolfram`Chatbook`ChatbookAction" ][ "AttachAssistantMessageButtons", cell ]
],
Method -> "Preemptive",
PassEventsDown -> Automatic,
PassEventsUp -> True
}
]
}
]


Cell[
StyleData[ "FeedbackButtonsHorizontal" ],
TemplateBoxOptions -> { DisplayFunction -> Function @ Evaluate @ ToBoxes @ $feedbackButtonsH }
]


(* ::Subsection::Closed:: *)
(*DropShadowPaneBox*)

Expand Down
65 changes: 60 additions & 5 deletions Developer/Resources/WorkspaceStyles.wl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Cell[
TaggingRules -> <| "ChatNotebookSettings" -> $workspaceDefaultSettings |>,
WindowClickSelect -> True,
WindowElements -> { "VerticalScrollBar" },
WindowFrame -> "ModelessDialog",
WindowFrameElements -> { "CloseBox", "ResizeArea" },
WindowMargins -> { { 0, Automatic }, { 0, 0 } },
WindowSize -> { $sideChatWidth, Automatic },
Expand All @@ -39,12 +38,12 @@ Cell[
Cell[
StyleData[ "ChatInput" ],
CellDingbat -> None,
CellEventActions -> None,
CellFrame -> 0,
CellFrameLabelMargins -> 6,
CellMargins -> { { 15, 10 }, { 5, 10 } },
Selectable -> True,
Selectable -> False,
ShowCellBracket -> False,
TextAlignment -> Right,
CellFrameLabels -> {
{ None, None },
{
Expand Down Expand Up @@ -74,9 +73,9 @@ Cell[
Background -> None,
CellDingbat -> None,
CellFrame -> 0,
CellMargins -> { { 10, 15 }, { 15, 12 } },
CellMargins -> { { 10, 15 }, { 25, 12 } },
Initialization -> None,
Selectable -> True,
Selectable -> False,
ShowCellBracket -> False,
CellFrameLabels -> {
{ None, None },
Expand Down Expand Up @@ -121,6 +120,16 @@ Cell[
)
]

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*CodeAssistanceWelcomeCell*)
Cell[
StyleData[ "CodeAssistanceWelcomeCell" ],
CellMargins -> { { 10, 10 }, { 30, 10 } },
ShowStringCharacters -> False,
TaggingRules -> <| "ChatNotebookSettings" -> <| "ExcludeFromChat" -> True |> |>
]

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Template Boxes*)
Expand Down Expand Up @@ -159,6 +168,52 @@ Cell[
}
]

(* ::**************************************************************************************************************:: *)
(* ::Subsection::Closed:: *)
(*WelcomeToCodeAssistanceSplash*)
Cell[
StyleData[ "WelcomeToCodeAssistanceSplash" ],
TemplateBoxOptions -> {
DisplayFunction -> Function @ Evaluate @ ToBoxes @ Framed[
Pane[
Grid[
{
{ Magnify[ RawBoxes @ TemplateBox[ { }, "ChatIconCodeAssistant" ], 5 ] },
{
Style[
"Welcome to Code Assistance Chat",
FontWeight -> Bold,
FontSize -> 17,
FontColor -> GrayLevel[ 0.25 ]
]
},
{ "Ask me anything using the input field below." },
{
Button[
"View Tutorial \[RightGuillemet]",
MessageDialog[ "Not implemented yet." ],
Appearance -> None,
BaseStyle -> { "Link" }
]
}
},
BaseStyle -> { "Text", FontSize -> 13, FontColor -> GrayLevel[ 0.5 ], LineBreakWithin -> False },
Spacings -> { 1, { 0, 1.25, 1.25, 0.75 } }
],
Alignment -> { Center, Automatic },
ImageSize -> { Scaled[ 1 ], Automatic },
ImageSizeAction -> "ShrinkToFit"
],
Alignment -> { Center, Automatic },
Background -> RGBColor[ "#fcfdff" ],
FrameMargins -> { { 10, 10 }, { 10, 10 } },
FrameStyle -> RGBColor[ "#ecf0f5" ],
ImageSize -> { Automatic, Automatic },
RoundingRadius -> 10
]
}
]

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Package Footer*)
Expand Down
Loading

0 comments on commit 3926b64

Please sign in to comment.