-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
When using the Citations API with documents (via mk_ant_doc), the response displays correctly in raw form but crashes when claudette tries to pretty-print it.
To reproduce:
from claudette import Chat, models
from msglm import mk_ant_doc
doc = mk_ant_doc("The capital of France is Paris.", title="France Facts")
chat = Chat(model=models[1])
r = chat([doc, "What is the capital of France?"])
r # crashes hereError:
AttributeError: 'CitationCharLocation' object has no attribute 'url'
Cause:
_cite() in blks2cited_txt() assumes web search citations (which have .url), but document citations have .document_title instead.
Suggested fix:
def _cite(i, cit):
esc = cit.cited_text.replace('"', r'\"')
src = getattr(cit, 'url', None) or cit.document_title
return f'[^{i+1}]: {src}\n\t"{esc}"'Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working