show_r
def show_r(
r
)->str:A result as terminal text.
/learn commands in the ramabana terminal agent: the same tutor, in the terminal, next to your code.
This module is a ramabana extension. It gives the /learn commands in the terminal, and it uses the same Tutor and Session as the web app. It also gives two tools, so the coding agent can add concepts to the graph while you code.
These are the imports of the module.
A ramabana extension is a file in ~/.config/ramabana/extensions/ with a setup(reg) function. To turn on this extension, do these steps:
~/.config/ramabana/extensions/abhyasa.py.from abhyasa.rama import setup.| command | what it does |
|---|---|
/learn [topic or slug] |
start a session; name a concept to learn only that concept |
/a <answer> |
answer; put the think-aloud after a line with -- |
/hint |
give the next hint |
/idk |
say “I don’t know” |
/teach |
stop this question and get the lesson |
/due |
list the concepts that are due |
The tutor uses the ramabana model call agent.oneshot. Thus [jobs] in config.toml sets its route. Two tools let the coding agent add to the graph while you code. learning_note files a concept that you just met. learning_due lists the concepts that are due.
_st keeps one store, one tutor and one open session for the terminal. The store and the tutor start on first use.
show_q and show_r make terminal text from a question and from a result.
find changes the argument of /learn into a slug. learn starts a session.
The slug for arg: a slug, else the best concept hit in search, else None.
These commands work on the open question. _need gives an error when no question is open.
due lists the concepts that are due for review.
The coding agent calls these tools. Their docstrings tell the agent what each tool does.
File a concept the user met while coding, so abhyasa can ask about it later. prereqs is comma-separated slugs.
setup registers the commands and the tools. _safe shows an error as text in the terminal.
A stand-in registry keeps the commands in a dict. A stand-in agent uses the fake model for oneshot.
from abhyasa.store import temp_learning
from abhyasa.llm import Fake
fake = Fake({'You grade one answer': dict(correct=True, grade=9, first_error='', misconception='', feedback='Yes.')},
dflt=dict(question='Why sort by score?', answer='To rank.', rubric=['rank']))
class Reg:
def __init__(self): self.commands, self.tools = {}, []
def command(self, n, f, help=''): self.commands[n] = f
def tool(self, f): self.tools.append(f)
agent = AttrDict(oneshot=lambda p, sp='', job='': fake(p, sp))
_st.update(lr=temp_learning(), tutor=None, sess=None)setup registers all six commands, and ans as a second name for a. An answer with no open question gives a clear message.
The agent files a concept. /learn asks about it, and /a grades the answer.
A concept that was just answered is not due.
The tutor follows the newest agent, and an error other than ValueError becomes one line.