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

More serialization rules #1035

Merged
merged 25 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b065852
Bugfix: Fixed a bad memoization definition that resulted in warning m…
rhennigan Jan 15, 2025
7dc8300
Bugfix: Fixed an evaluation leak in serialization
rhennigan Jan 15, 2025
58a8488
Handle some more control boxes
rhennigan Jan 15, 2025
ae8b720
More template boxes and controls
rhennigan Jan 16, 2025
0fc5cab
Handle file listing cells in workflow notebooks
rhennigan Jan 16, 2025
fbee2db
More documentation related fixes
rhennigan Jan 16, 2025
ca7ea0e
Handle TextForm
rhennigan Jan 16, 2025
b1e1716
Bugfix: Some box patterns didn't handle options
rhennigan Jan 16, 2025
76d9af1
More DynamicBox patterns
rhennigan Jan 16, 2025
b0b3884
Fallback for Tabular that's no longer in kernel session
rhennigan Jan 16, 2025
bc2e74e
Bugfix: OS-specific dynamics
rhennigan Jan 16, 2025
20ed831
Handle some more FE resources
rhennigan Jan 16, 2025
3b4a1c1
Fix handling of DisplayFunction and InterpretationFunction specs that…
rhennigan Jan 16, 2025
d9ae4c3
Spelling
rhennigan Jan 16, 2025
ef88555
Additional minor fixes
rhennigan Jan 16, 2025
4f2b917
More serialization fixes
rhennigan Jan 18, 2025
f7d1460
Combine adjacent hyperlinks if they point to the same URI
rhennigan Jan 19, 2025
2c6e037
More improvements for documentation markdown
rhennigan Jan 19, 2025
f28f188
Never serialize entire input cells as a single markdown image box
rhennigan Jan 19, 2025
b6c78b6
More markdown post processing rules
rhennigan Jan 19, 2025
8f3667f
Bugfix: Fixed an internal error during serialization of some button b…
rhennigan Jan 19, 2025
c0bdbc2
WL versioned vector databases for documentation
rhennigan Jan 20, 2025
c4f7965
Bugfix: Need to delay evaluation of doc snippet URL so it doesn't get…
rhennigan Jan 21, 2025
8ca6d19
Bugfix: Fixed format of 14.2 doc version specifier
rhennigan Jan 21, 2025
ec8e8b5
Increment paclet version
rhennigan Jan 21, 2025
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
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"Deinitialization",
"Demi",
"Dirtiable",
"Docu",
"dpkg",
"EFAIL",
"ENDARGUMENTS",
Expand Down Expand Up @@ -79,6 +80,7 @@
"Subsubsubsection",
"Subsubsubsubsection",
"Subsubtitle",
"Subsuperscript",
"tabletags",
"tavily",
"textbf",
Expand Down
Binary file added Assets/TemplateBoxOptions.wxf
Binary file not shown.
13 changes: 7 additions & 6 deletions PacletInfo.wl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PacletObject[ <|
"Name" -> "Wolfram/Chatbook",
"PublisherID" -> "Wolfram",
"Version" -> "2.0.20",
"Version" -> "2.1.0",
"WolframVersion" -> "14.1+",
"Description" -> "Wolfram Notebooks + LLMs",
"License" -> "MIT",
Expand Down Expand Up @@ -34,11 +34,12 @@ PacletObject[ <|
{ "Asset",
"Root" -> "Assets",
"Assets" -> {
{ "AIAssistant" , "AIAssistant" },
{ "DisplayFunctions", "DisplayFunctions.wxf" },
{ "Icons" , "Icons.wxf" },
{ "SandboxMessages" , "SandboxMessages.wl" },
{ "Tokenizers" , "Tokenizers" }
{ "AIAssistant" , "AIAssistant" },
{ "DisplayFunctions" , "DisplayFunctions.wxf" },
{ "Icons" , "Icons.wxf" },
{ "SandboxMessages" , "SandboxMessages.wl" },
{ "TemplateBoxOptions", "TemplateBoxOptions.wxf" },
{ "Tokenizers" , "Tokenizers" }
}
},
{ "LLMConfiguration",
Expand Down
1 change: 1 addition & 0 deletions Source/Chatbook/CommonSymbols.wl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ BeginPackage[ "Wolfram`Chatbook`Common`" ];
`$simpleToolMethod;
`$statelessProgressIndicator;
`$suppressButtonAppearance;
`$templateBoxOptionsCache;
`$timingLog;
`$tinyHashLength;
`$tokenBudget;
Expand Down
2 changes: 1 addition & 1 deletion Source/Chatbook/FrontEnd.wl
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ rasterize // endDefinition;
(*replaceCellContext*)
replaceCellContext // beginDefinition;

replaceCellContext[ expr_ ] := replaceCellContext[ expr ] = ReplaceAll[
replaceCellContext[ expr_ ] := replaceCellContext[ Verbatim[ expr ] ] = ReplaceAll[
expr,
s_Symbol /; AtomQ @ Unevaluated @ s && Context @ Unevaluated @ s === "$CellContext`" :>
With[ { new = ToExpression[ $Context <> SymbolName @ Unevaluated @ s, InputForm, $ConditionHold ] },
Expand Down
2 changes: 2 additions & 0 deletions Source/Chatbook/Handlers.wl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ applyHandlerFunction[ settings_Association, name_String, args0_ ] := Enclose[
args = ConfirmBy[
<|
"EventName" -> name,
(* FIXME: Add settings at start of evaluation instead of each function call *)
"ChatNotebookSettings" -> KeyDrop[ settings, $settingsDroppedKeys ],
args0
|>,
Expand Down Expand Up @@ -178,6 +179,7 @@ applyProcessingFunction[ settings_Association, name_String, args_HoldComplete, p
addProcessingArguments[
name,
<|
(* FIXME: Add settings at start of evaluation instead of each function call *)
"ChatNotebookSettings" -> KeyDrop[ settings, $settingsDroppedKeys ],
"DefaultProcessingFunction" -> default,
params
Expand Down
15 changes: 10 additions & 5 deletions Source/Chatbook/PromptGenerators/RelatedDocumentation.wl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Needs[ "Wolfram`Chatbook`PromptGenerators`Common`" ];
(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Configuration*)
$snippetType = "Text";
$documentationSnippetVersion = "14-1-0-10549042";
$baseURL = "https://www.wolframcloud.com/obj/wolframai-content/DocumentationSnippets";
$documentationSnippetBaseURL = URLBuild @ { $baseURL, $documentationSnippetVersion, $snippetType };
$resourceSnippetBaseURL = URLBuild @ { $baseURL, "Resources", $snippetType };
$snippetType = "Text";
$documentationSnippetVersion := $snippetVersion;
$baseURL = "https://www.wolframcloud.com/obj/wolframai-content/DocumentationSnippets";
$documentationSnippetBaseURL := URLBuild @ { $baseURL, $documentationSnippetVersion, $snippetType };
$resourceSnippetBaseURL = URLBuild @ { $baseURL, "Resources", $snippetType };

$documentationSnippetsCacheDirectory := $documentationSnippetsCacheDirectory =
ChatbookFilesDirectory @ { "DocumentationSnippets", "Documentation", $documentationSnippetVersion };
Expand Down Expand Up @@ -46,6 +46,11 @@ $unfilteredItemsPerSource = 10;

$filteringLLMConfig = <| "StopTokens" -> { "CasualChat" } |>;

(* ::**************************************************************************************************************:: *)
(* ::Subsection::Closed:: *)
(*$snippetVersion*)
$snippetVersion := $snippetVersion = If[ $VersionNumber >= 14.2, "14-2-0-11168610", "14-1-0-10549042" ];

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Messages*)
Expand Down
16 changes: 9 additions & 7 deletions Source/Chatbook/PromptGenerators/VectorDatabases.wl
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ HoldComplete[
(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Configuration*)
$vectorDatabases = <|
"DataRepositoryURIs" -> <| "Version" -> "1.0.0", "Bias" -> 1.0, "SnippetFunction" -> getSnippets |>,
"DocumentationURIs" -> <| "Version" -> "1.3.0", "Bias" -> 0.0, "SnippetFunction" -> getSnippets |>,
"FunctionRepositoryURIs" -> <| "Version" -> "1.0.0", "Bias" -> 1.0, "SnippetFunction" -> getSnippets |>,
"WolframAlphaQueries" -> <| "Version" -> "1.3.0", "Bias" -> 0.0, "SnippetFunction" -> Identity |>
$vectorDatabases := $vectorDatabases = <|
"DataRepositoryURIs" -> <| "Version" -> "1.0.0" , "Bias" -> 1.0, "SnippetFunction" -> getSnippets |>,
"DocumentationURIs" -> <| "Version" -> $docVersion, "Bias" -> 0.0, "SnippetFunction" -> getSnippets |>,
"FunctionRepositoryURIs" -> <| "Version" -> "1.0.0" , "Bias" -> 1.0, "SnippetFunction" -> getSnippets |>,
"WolframAlphaQueries" -> <| "Version" -> "1.3.0" , "Bias" -> 0.0, "SnippetFunction" -> Identity |>
|>;

$vectorDBNames = Keys @ $vectorDatabases;
$docVersion := If[ $VersionNumber >= 14.2, "1.4.0", "1.3.0" ];

$vectorDBNames := $vectorDBNames = Keys @ $vectorDatabases;
$allowDownload = True;
$cacheEmbeddings = True;

Expand All @@ -48,7 +50,7 @@ $maxExtraFiles = 20;
(*Remote Content Locations*)
$baseVectorDatabasesURL = "https://www.wolframcloud.com/obj/wolframai-content/VectorDatabases";

$vectorDBDownloadURLs = AssociationMap[
$vectorDBDownloadURLs := $vectorDBDownloadURLs = AssociationMap[
URLBuild @ { $baseVectorDatabasesURL, #, $vectorDatabases[ #, "Version" ], # <> ".zip" } &,
$vectorDBNames
];
Expand Down
Loading
Loading