File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,11 @@ class Citations(Type):
1616
1717 Example:
1818 ```python
19+ import os
1920 import dspy
2021 from dspy.signatures import Signature
2122 from dspy.experimental import Citations, Document
23+ os.environ["ANTHROPIC_API_KEY"] = "YOUR_ANTHROPIC_API_KEY"
2224
2325 class AnswerWithSources(Signature):
2426 '''Answer questions using provided documents with citations.'''
@@ -42,8 +44,8 @@ class AnswerWithSources(Signature):
4244
4345 # Use with a model that supports citations like Claude
4446 lm = dspy.LM("anthropic/claude-opus-4-1-20250805")
45- predictor = dspy.Predict(AnswerWithSources, lm=lm )
46- result = predictor(documents=docs, question="What temperature does water boil?")
47+ predictor = dspy.Predict(AnswerWithSources)
48+ result = predictor(documents=docs, question="What temperature does water boil?", lm=lm )
4749
4850 for citation in result.citations.citations:
4951 print(citation.format())
You can’t perform that action at this time.
0 commit comments