Fwd: Ask about the SageMath codebase using ChatGPT

Skip to first unread message

William Stein

Jun 30, 2023, 4:37:38 PMJun 30
to sage-support
This is about a more "grounded" version of ChatGPT + Sage that is now at


---------- Forwarded message ---------
From: William Stein <wst...@sagemath.com>
Date: Fri, Jun 30, 2023 at 11:41 AM
Subject: Ask about the SageMath codebase using ChatGPT
To: sage-devel <sage-...@googlegroups.com>
Cc: <na...@wolfia.com>


Summary: Try asking anything about the SageMath codebase at



There's a project called "Wolfia" that does the following with a codebase:

"Wolfia Codex works by indexing an entire codebase. This is done by
first chunking each file into smaller code snippets. Those snippets
and other metadata are then persisted using vector embeddings.

When you ask a question about a codebase, that question is also
converted into a vector embedding. This is compared to all of the
available code and metadata to find the most relevant code.

The relevant code is then inlined as context to various prompts
(general questions, debugging errors, or documentation generation) and
sent to a Large Language Model to generate an answer to your question
based on the provided code."

I asked them to index the sagemath codebase and they did. You can try it here


The point is that instead of using GPT's vague memory of what it might
have seen, this instead uses the actual Sage source code, and mainly
uses GPT to make sense of it.

---------- Forwarded message ---------
From: Naren Manoharan <na...@wolfia.com>
Date: Fri, Jun 30, 2023 at 10:53 AM
Subject: Thank you for signing up and Welcome Wolfia!
To: <wst...@sagemath.com>

Hey William,

Thanks for signing up and requesting us to index -

This is now available here -

Feel free to grab time here if you have any questions or feedback -

I would love to hear any feedback or thoughts that you have! I'm a big
fan of open core projects. Let me know if I can help in any way.

Co-Founder & CTO at Wolfia (YC S22)
(314) 562-8039 | LinkedIn | Twitter


Best Regards,
William Stein

CEO, SageMath, Inc.


Best Regards,
William Stein

CEO, SageMath, Inc.

Raymond Rogers

Jun 30, 2023, 10:20:14 PMJun 30
to sage-s...@googlegroups.com

Thanks! :)   I tried it with something that was coming up for me.

Ray:"How do I do 2d plots of polygons using complex numbers as coordinates"

It worked with explanations! 
Unfortunately the code didn't work.  Almost though,  so we (wolfia.com) worked on it for a couple of rounds. 
We gave up, but I am really impressed.  It did self-correct a couple of things but they weren't the core problem. 
No complaints about the  performance though; I have a tendency to uncover bugs LOL
I would appreciate if somebody on the group would try the query and answer, and if a sagemath/sage  bug is found, tell me how to file it. 
I would have copied the  transcript, but it's disappeared!
Or get it to work:)  I am working up a problem on a social media site and want to illustrate a polygon formula for constructing edge midpoint polygons from polygons; and reverse midpoint polygons to "full polygons.

In case you think I am lazy; I am.
Let me tell you, some of the manual sections are over 10,000 pages :)

Ubuntu mate-local build-python 3.10.6-Sagemat 10.0
No known problems
Both "sage" and "/opt/sage-10.0/sage --notebook  jupyterlab"
Had the same error.

Reply all
Reply to author
0 new messages