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

Exclude WolframAlpha pods that have missing content from text sent to the LLM #571

Merged
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions Source/Chatbook/Tools/DefaultTools.wl
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ waResultText0[ as: KeyValuePattern @ { "Title" -> title_String, "Data" -> data_
waResultText0[ as: KeyValuePattern[ _Integer -> _ ] ] :=
waResultText0 /@ Values @ KeySort @ KeySelect[ as, IntegerQ ];

waResultText0[ KeyValuePattern @ { "Content"|"ComputableData" -> expr_ } ] /;
! FreeQ[ Unevaluated @ expr, _Missing ] := Nothing;

waResultText0[ KeyValuePattern @ { "Plaintext" -> text_String, "ComputableData" -> Hold[ expr_ ] } ] :=
If[ ByteCount @ Unevaluated @ expr >= 500,
If[ StringFreeQ[ text, "["|"]"|"\n" ],
Expand Down Expand Up @@ -851,7 +854,7 @@ Out[n]= Piecewise[...]
![Formatted Result](expression://content-{id})

[assistant]
The half-order fractional derivative of $x^n$ with respect to $x$ is given by:
The half-order fractional derivative of $$x^n$$ with respect to $$x$$ is given by:
![Fractional Derivative](expression://content-{id})
";

Expand All @@ -872,7 +875,7 @@ Plot sin(x) from -5 to 5
Out[n]= ![image](attachment://content-{id})

[assistant]
Here's the plot of $\\sin{x}$ from -5 to 5:
Here's the plot of $$\\sin{x}$$ from -5 to 5:
![Plot](attachment://content-{id})"
];

Expand Down
Loading