Skip to content

Commit 98ae65e

Browse files
authored
Merge pull request #1035 from WolframResearch/bugfix/more-serialization-rules
More serialization rules
2 parents 9ac4277 + ec8e8b5 commit 98ae65e

File tree

10 files changed

+469
-89
lines changed

10 files changed

+469
-89
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"Deinitialization",
2121
"Demi",
2222
"Dirtiable",
23+
"Docu",
2324
"dpkg",
2425
"EFAIL",
2526
"ENDARGUMENTS",
@@ -79,6 +80,7 @@
7980
"Subsubsubsection",
8081
"Subsubsubsubsection",
8182
"Subsubtitle",
83+
"Subsuperscript",
8284
"tabletags",
8385
"tavily",
8486
"textbf",

Assets/TemplateBoxOptions.wxf

131 KB
Binary file not shown.

PacletInfo.wl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PacletObject[ <|
22
"Name" -> "Wolfram/Chatbook",
33
"PublisherID" -> "Wolfram",
4-
"Version" -> "2.0.20",
4+
"Version" -> "2.1.0",
55
"WolframVersion" -> "14.1+",
66
"Description" -> "Wolfram Notebooks + LLMs",
77
"License" -> "MIT",
@@ -34,11 +34,12 @@ PacletObject[ <|
3434
{ "Asset",
3535
"Root" -> "Assets",
3636
"Assets" -> {
37-
{ "AIAssistant" , "AIAssistant" },
38-
{ "DisplayFunctions", "DisplayFunctions.wxf" },
39-
{ "Icons" , "Icons.wxf" },
40-
{ "SandboxMessages" , "SandboxMessages.wl" },
41-
{ "Tokenizers" , "Tokenizers" }
37+
{ "AIAssistant" , "AIAssistant" },
38+
{ "DisplayFunctions" , "DisplayFunctions.wxf" },
39+
{ "Icons" , "Icons.wxf" },
40+
{ "SandboxMessages" , "SandboxMessages.wl" },
41+
{ "TemplateBoxOptions", "TemplateBoxOptions.wxf" },
42+
{ "Tokenizers" , "Tokenizers" }
4243
}
4344
},
4445
{ "LLMConfiguration",

Source/Chatbook/CommonSymbols.wl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ BeginPackage[ "Wolfram`Chatbook`Common`" ];
8181
`$simpleToolMethod;
8282
`$statelessProgressIndicator;
8383
`$suppressButtonAppearance;
84+
`$templateBoxOptionsCache;
8485
`$timingLog;
8586
`$tinyHashLength;
8687
`$tokenBudget;

Source/Chatbook/FrontEnd.wl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ rasterize // endDefinition;
13281328
(*replaceCellContext*)
13291329
replaceCellContext // beginDefinition;
13301330

1331-
replaceCellContext[ expr_ ] := replaceCellContext[ expr ] = ReplaceAll[
1331+
replaceCellContext[ expr_ ] := replaceCellContext[ Verbatim[ expr ] ] = ReplaceAll[
13321332
expr,
13331333
s_Symbol /; AtomQ @ Unevaluated @ s && Context @ Unevaluated @ s === "$CellContext`" :>
13341334
With[ { new = ToExpression[ $Context <> SymbolName @ Unevaluated @ s, InputForm, $ConditionHold ] },

Source/Chatbook/Handlers.wl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ applyHandlerFunction[ settings_Association, name_String, args0_ ] := Enclose[
6767
args = ConfirmBy[
6868
<|
6969
"EventName" -> name,
70+
(* FIXME: Add settings at start of evaluation instead of each function call *)
7071
"ChatNotebookSettings" -> KeyDrop[ settings, $settingsDroppedKeys ],
7172
args0
7273
|>,
@@ -178,6 +179,7 @@ applyProcessingFunction[ settings_Association, name_String, args_HoldComplete, p
178179
addProcessingArguments[
179180
name,
180181
<|
182+
(* FIXME: Add settings at start of evaluation instead of each function call *)
181183
"ChatNotebookSettings" -> KeyDrop[ settings, $settingsDroppedKeys ],
182184
"DefaultProcessingFunction" -> default,
183185
params

Source/Chatbook/PromptGenerators/RelatedDocumentation.wl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Needs[ "Wolfram`Chatbook`PromptGenerators`Common`" ];
1010
(* ::**************************************************************************************************************:: *)
1111
(* ::Section::Closed:: *)
1212
(*Configuration*)
13-
$snippetType = "Text";
14-
$documentationSnippetVersion = "14-1-0-10549042";
15-
$baseURL = "https://www.wolframcloud.com/obj/wolframai-content/DocumentationSnippets";
16-
$documentationSnippetBaseURL = URLBuild @ { $baseURL, $documentationSnippetVersion, $snippetType };
17-
$resourceSnippetBaseURL = URLBuild @ { $baseURL, "Resources", $snippetType };
13+
$snippetType = "Text";
14+
$documentationSnippetVersion := $snippetVersion;
15+
$baseURL = "https://www.wolframcloud.com/obj/wolframai-content/DocumentationSnippets";
16+
$documentationSnippetBaseURL := URLBuild @ { $baseURL, $documentationSnippetVersion, $snippetType };
17+
$resourceSnippetBaseURL = URLBuild @ { $baseURL, "Resources", $snippetType };
1818

1919
$documentationSnippetsCacheDirectory := $documentationSnippetsCacheDirectory =
2020
ChatbookFilesDirectory @ { "DocumentationSnippets", "Documentation", $documentationSnippetVersion };
@@ -46,6 +46,11 @@ $unfilteredItemsPerSource = 10;
4646

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

49+
(* ::**************************************************************************************************************:: *)
50+
(* ::Subsection::Closed:: *)
51+
(*$snippetVersion*)
52+
$snippetVersion := $snippetVersion = If[ $VersionNumber >= 14.2, "14-2-0-11168610", "14-1-0-10549042" ];
53+
4954
(* ::**************************************************************************************************************:: *)
5055
(* ::Section::Closed:: *)
5156
(*Messages*)

Source/Chatbook/PromptGenerators/VectorDatabases.wl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ HoldComplete[
1515
(* ::**************************************************************************************************************:: *)
1616
(* ::Section::Closed:: *)
1717
(*Configuration*)
18-
$vectorDatabases = <|
19-
"DataRepositoryURIs" -> <| "Version" -> "1.0.0", "Bias" -> 1.0, "SnippetFunction" -> getSnippets |>,
20-
"DocumentationURIs" -> <| "Version" -> "1.3.0", "Bias" -> 0.0, "SnippetFunction" -> getSnippets |>,
21-
"FunctionRepositoryURIs" -> <| "Version" -> "1.0.0", "Bias" -> 1.0, "SnippetFunction" -> getSnippets |>,
22-
"WolframAlphaQueries" -> <| "Version" -> "1.3.0", "Bias" -> 0.0, "SnippetFunction" -> Identity |>
18+
$vectorDatabases := $vectorDatabases = <|
19+
"DataRepositoryURIs" -> <| "Version" -> "1.0.0" , "Bias" -> 1.0, "SnippetFunction" -> getSnippets |>,
20+
"DocumentationURIs" -> <| "Version" -> $docVersion, "Bias" -> 0.0, "SnippetFunction" -> getSnippets |>,
21+
"FunctionRepositoryURIs" -> <| "Version" -> "1.0.0" , "Bias" -> 1.0, "SnippetFunction" -> getSnippets |>,
22+
"WolframAlphaQueries" -> <| "Version" -> "1.3.0" , "Bias" -> 0.0, "SnippetFunction" -> Identity |>
2323
|>;
2424

25-
$vectorDBNames = Keys @ $vectorDatabases;
25+
$docVersion := If[ $VersionNumber >= 14.2, "1.4.0", "1.3.0" ];
26+
27+
$vectorDBNames := $vectorDBNames = Keys @ $vectorDatabases;
2628
$allowDownload = True;
2729
$cacheEmbeddings = True;
2830

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

51-
$vectorDBDownloadURLs = AssociationMap[
53+
$vectorDBDownloadURLs := $vectorDBDownloadURLs = AssociationMap[
5254
URLBuild @ { $baseVectorDatabasesURL, #, $vectorDatabases[ #, "Version" ], # <> ".zip" } &,
5355
$vectorDBNames
5456
];

0 commit comments

Comments
 (0)