DSPy: The framework for programming—not prompting—language models
Python
Allow arbitrary writeup in the api reference (#8123)
Chen Qian103d3d7b336c
diff --git a/docs/docs/api/adapters/Adapter.md b/docs/docs/api/adapters/Adapter.mdindex 2b04a8199..3d2666331 100644--- a/docs/docs/api/adapters/Adapter.md+++ b/docs/docs/api/adapters/Adapter.md@@ -1,10 +1,12 @@# dspy.Adapter+<!-- START_API_REF -->::: dspy.Adapterhandler: pythonoptions:members:- __call__+ - acall- format- format_assistant_message_content- format_conversation_history@@ -22,3 +24,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/adapters/ChatAdapter.md b/docs/docs/api/adapters/ChatAdapter.mdindex b67871a30..e76eeec05 100644--- a/docs/docs/api/adapters/ChatAdapter.md+++ b/docs/docs/api/adapters/ChatAdapter.md@@ -1,10 +1,12 @@# dspy.ChatAdapter+<!-- START_API_REF -->::: dspy.ChatAdapterhandler: pythonoptions:members:- __call__+ - acall- format- format_assistant_message_content- format_conversation_history@@ -25,3 +27,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/adapters/JSONAdapter.md b/docs/docs/api/adapters/JSONAdapter.mdindex 4a5fb1212..0043c95ea 100644--- a/docs/docs/api/adapters/JSONAdapter.md+++ b/docs/docs/api/adapters/JSONAdapter.md@@ -1,10 +1,12 @@# dspy.JSONAdapter+<!-- START_API_REF -->::: dspy.JSONAdapterhandler: pythonoptions:members:- __call__+ - acall- format- format_assistant_message_content- format_conversation_history@@ -25,3 +27,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/adapters/TwoStepAdapter.md b/docs/docs/api/adapters/TwoStepAdapter.mdindex 767a044e3..aea44e4b3 100644--- a/docs/docs/api/adapters/TwoStepAdapter.md+++ b/docs/docs/api/adapters/TwoStepAdapter.md@@ -1,10 +1,12 @@# dspy.TwoStepAdapter+<!-- START_API_REF -->::: dspy.TwoStepAdapterhandler: pythonoptions:members:- __call__+ - acall- format- format_assistant_message_content- format_conversation_history@@ -22,3 +24,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/evaluation/CompleteAndGrounded.md b/docs/docs/api/evaluation/CompleteAndGrounded.mdindex b2662ce9d..d6e65b4f0 100644--- a/docs/docs/api/evaluation/CompleteAndGrounded.md+++ b/docs/docs/api/evaluation/CompleteAndGrounded.md@@ -1,10 +1,12 @@# dspy.evaluate.CompleteAndGrounded+<!-- START_API_REF -->::: dspy.evaluate.CompleteAndGroundedhandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -29,3 +31,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/evaluation/Evaluate.md b/docs/docs/api/evaluation/Evaluate.mdindex acefdb6d7..17d369d72 100644--- a/docs/docs/api/evaluation/Evaluate.md+++ b/docs/docs/api/evaluation/Evaluate.md@@ -1,5 +1,6 @@# dspy.Evaluate+<!-- START_API_REF -->::: dspy.Evaluatehandler: pythonoptions:@@ -13,3 +14,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/evaluation/SemanticF1.md b/docs/docs/api/evaluation/SemanticF1.mdindex 969685769..c34283ff3 100644--- a/docs/docs/api/evaluation/SemanticF1.md+++ b/docs/docs/api/evaluation/SemanticF1.md@@ -1,10 +1,12 @@# dspy.evaluate.SemanticF1+<!-- START_API_REF -->::: dspy.evaluate.SemanticF1handler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -29,3 +31,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/evaluation/answer_exact_match.md b/docs/docs/api/evaluation/answer_exact_match.mdindex a876481e4..f3faa5f6a 100644--- a/docs/docs/api/evaluation/answer_exact_match.md+++ b/docs/docs/api/evaluation/answer_exact_match.md@@ -1,5 +1,6 @@# dspy.evaluate.answer_exact_match+<!-- START_API_REF -->::: dspy.evaluate.answer_exact_matchhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/evaluation/answer_passage_match.md b/docs/docs/api/evaluation/answer_passage_match.mdindex e8da0a80f..2fcbaf524 100644--- a/docs/docs/api/evaluation/answer_passage_match.md+++ b/docs/docs/api/evaluation/answer_passage_match.md@@ -1,5 +1,6 @@# dspy.evaluate.answer_passage_match+<!-- START_API_REF -->::: dspy.evaluate.answer_passage_matchhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/models/Embedder.md b/docs/docs/api/models/Embedder.mdindex 7fe3d8bde..48a2459ab 100644--- a/docs/docs/api/models/Embedder.md+++ b/docs/docs/api/models/Embedder.md@@ -1,10 +1,12 @@# dspy.Embedder+<!-- START_API_REF -->::: dspy.Embedderhandler: pythonoptions:members:- __call__+ - acallshow_source: trueshow_root_heading: trueheading_level: 2@@ -13,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/models/LM.md b/docs/docs/api/models/LM.mdindex b7da53cae..0eecbd830 100644--- a/docs/docs/api/models/LM.md+++ b/docs/docs/api/models/LM.md@@ -1,10 +1,13 @@# dspy.LM+<!-- START_API_REF -->::: dspy.LMhandler: pythonoptions:members:- __call__+ - acall+ - aforward- copy- dump_state- finetune@@ -22,3 +25,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/BestOfN.md b/docs/docs/api/modules/BestOfN.mdindex 3df7745d3..4439017f1 100644--- a/docs/docs/api/modules/BestOfN.md+++ b/docs/docs/api/modules/BestOfN.md@@ -1,10 +1,12 @@# dspy.BestOfN+<!-- START_API_REF -->::: dspy.BestOfNhandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -29,3 +31,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/ChainOfThought.md b/docs/docs/api/modules/ChainOfThought.mdindex 1bc06577b..125ba6f85 100644--- a/docs/docs/api/modules/ChainOfThought.md+++ b/docs/docs/api/modules/ChainOfThought.md@@ -1,10 +1,13 @@# dspy.ChainOfThought+<!-- START_API_REF -->::: dspy.ChainOfThoughthandler: pythonoptions:members:- __call__+ - acall+ - aforward- batch- deepcopy- dump_state@@ -29,3 +32,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/ChainOfThoughtWithHint.md b/docs/docs/api/modules/ChainOfThoughtWithHint.mdindex 058c00c23..cbd4071f1 100644--- a/docs/docs/api/modules/ChainOfThoughtWithHint.md+++ b/docs/docs/api/modules/ChainOfThoughtWithHint.md@@ -1,10 +1,12 @@# dspy.ChainOfThoughtWithHint+<!-- START_API_REF -->::: dspy.ChainOfThoughtWithHinthandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -29,3 +31,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/Module.md b/docs/docs/api/modules/Module.mdindex 7a16122f8..f28ea31ef 100644--- a/docs/docs/api/modules/Module.md+++ b/docs/docs/api/modules/Module.md@@ -1,10 +1,12 @@# dspy.Module+<!-- START_API_REF -->::: dspy.Modulehandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -28,3 +30,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/MultiChainComparison.md b/docs/docs/api/modules/MultiChainComparison.mdindex fab0e8022..5f8575ebf 100644--- a/docs/docs/api/modules/MultiChainComparison.md+++ b/docs/docs/api/modules/MultiChainComparison.md@@ -1,10 +1,12 @@# dspy.MultiChainComparison+<!-- START_API_REF -->::: dspy.MultiChainComparisonhandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -29,3 +31,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/Parallel.md b/docs/docs/api/modules/Parallel.mdindex 8652791b0..f935c2dbf 100644--- a/docs/docs/api/modules/Parallel.md+++ b/docs/docs/api/modules/Parallel.md@@ -1,5 +1,6 @@# dspy.Parallel+<!-- START_API_REF -->::: dspy.Parallelhandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/Predict.md b/docs/docs/api/modules/Predict.mdindex 055b3b057..c7749b2a4 100644--- a/docs/docs/api/modules/Predict.md+++ b/docs/docs/api/modules/Predict.md@@ -1,10 +1,13 @@# dspy.Predict+<!-- START_API_REF -->::: dspy.Predicthandler: pythonoptions:members:- __call__+ - acall+ - aforward- batch- deepcopy- dump_state@@ -32,3 +35,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/Program.md b/docs/docs/api/modules/Program.mdindex 51482b387..084cc0269 100644--- a/docs/docs/api/modules/Program.md+++ b/docs/docs/api/modules/Program.md@@ -1,10 +1,12 @@# dspy.Program+<!-- START_API_REF -->::: dspy.Programhandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -28,3 +30,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/ProgramOfThought.md b/docs/docs/api/modules/ProgramOfThought.mdindex 8dc409c6a..a3ad792da 100644--- a/docs/docs/api/modules/ProgramOfThought.md+++ b/docs/docs/api/modules/ProgramOfThought.md@@ -1,10 +1,12 @@# dspy.ProgramOfThought+<!-- START_API_REF -->::: dspy.ProgramOfThoughthandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -29,3 +31,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/ReAct.md b/docs/docs/api/modules/ReAct.mdindex 00bcb9b7a..a2f728e80 100644--- a/docs/docs/api/modules/ReAct.md+++ b/docs/docs/api/modules/ReAct.md@@ -1,10 +1,12 @@# dspy.ReAct+<!-- START_API_REF -->::: dspy.ReActhandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -30,3 +32,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/modules/Refine.md b/docs/docs/api/modules/Refine.mdindex 3cfac2497..b75d0218e 100644--- a/docs/docs/api/modules/Refine.md+++ b/docs/docs/api/modules/Refine.md@@ -1,10 +1,12 @@# dspy.Refine+<!-- START_API_REF -->::: dspy.Refinehandler: pythonoptions:members:- __call__+ - acall- batch- deepcopy- dump_state@@ -29,3 +31,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/BetterTogether.md b/docs/docs/api/optimizers/BetterTogether.mdindex 69208b777..430639246 100644--- a/docs/docs/api/optimizers/BetterTogether.md+++ b/docs/docs/api/optimizers/BetterTogether.md@@ -1,5 +1,6 @@# dspy.BetterTogether+<!-- START_API_REF -->::: dspy.BetterTogetherhandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/BootstrapFewShot.md b/docs/docs/api/optimizers/BootstrapFewShot.mdindex b76c9e4a6..3dace8195 100644--- a/docs/docs/api/optimizers/BootstrapFewShot.md+++ b/docs/docs/api/optimizers/BootstrapFewShot.md@@ -1,5 +1,6 @@# dspy.BootstrapFewShot+<!-- START_API_REF -->::: dspy.BootstrapFewShothandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md b/docs/docs/api/optimizers/BootstrapFewShotWithRandomSearch.mdindex 6fa6a64b6..f2df1530b 100644--- a/docs/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md+++ b/docs/docs/api/optimizers/BootstrapFewShotWithRandomSearch.md@@ -1,5 +1,6 @@# dspy.BootstrapFewShotWithRandomSearch+<!-- START_API_REF -->::: dspy.BootstrapFewShotWithRandomSearchhandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/BootstrapFinetune.md b/docs/docs/api/optimizers/BootstrapFinetune.mdindex ac27a7110..8f1d3a337 100644--- a/docs/docs/api/optimizers/BootstrapFinetune.md+++ b/docs/docs/api/optimizers/BootstrapFinetune.md@@ -1,5 +1,6 @@# dspy.BootstrapFinetune+<!-- START_API_REF -->::: dspy.BootstrapFinetunehandler: pythonoptions:@@ -16,3 +17,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/BootstrapRS.md b/docs/docs/api/optimizers/BootstrapRS.mdindex bc2821356..df523b4e7 100644--- a/docs/docs/api/optimizers/BootstrapRS.md+++ b/docs/docs/api/optimizers/BootstrapRS.md@@ -1,5 +1,6 @@# dspy.BootstrapRS+<!-- START_API_REF -->::: dspy.BootstrapRShandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/COPRO.md b/docs/docs/api/optimizers/COPRO.mdindex 53e1bc376..89926b407 100644--- a/docs/docs/api/optimizers/COPRO.md+++ b/docs/docs/api/optimizers/COPRO.md@@ -1,5 +1,6 @@# dspy.COPRO+<!-- START_API_REF -->::: dspy.COPROhandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/Ensemble.md b/docs/docs/api/optimizers/Ensemble.mdindex 1585f5c5b..58aef770f 100644--- a/docs/docs/api/optimizers/Ensemble.md+++ b/docs/docs/api/optimizers/Ensemble.md@@ -1,5 +1,6 @@# dspy.Ensemble+<!-- START_API_REF -->::: dspy.Ensemblehandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/InferRules.md b/docs/docs/api/optimizers/InferRules.mdindex 797814b99..035c0b138 100644--- a/docs/docs/api/optimizers/InferRules.md+++ b/docs/docs/api/optimizers/InferRules.md@@ -1,5 +1,6 @@# dspy.InferRules+<!-- START_API_REF -->::: dspy.InferRuleshandler: pythonoptions:@@ -19,3 +20,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/KNN.md b/docs/docs/api/optimizers/KNN.mdindex e37cd93d8..d8c3fcf94 100644--- a/docs/docs/api/optimizers/KNN.md+++ b/docs/docs/api/optimizers/KNN.md@@ -1,5 +1,6 @@# dspy.KNN+<!-- START_API_REF -->::: dspy.KNNhandler: pythonoptions:@@ -13,3 +14,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/KNNFewShot.md b/docs/docs/api/optimizers/KNNFewShot.mdindex 9b3bba7f4..758a6f819 100644--- a/docs/docs/api/optimizers/KNNFewShot.md+++ b/docs/docs/api/optimizers/KNNFewShot.md@@ -1,5 +1,6 @@# dspy.KNNFewShot+<!-- START_API_REF -->::: dspy.KNNFewShothandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/LabeledFewShot.md b/docs/docs/api/optimizers/LabeledFewShot.mdindex 203922cd0..f1d96313e 100644--- a/docs/docs/api/optimizers/LabeledFewShot.md+++ b/docs/docs/api/optimizers/LabeledFewShot.md@@ -1,5 +1,6 @@# dspy.LabeledFewShot+<!-- START_API_REF -->::: dspy.LabeledFewShothandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/optimizers/MIPROv2.md b/docs/docs/api/optimizers/MIPROv2.mdindex 241dd0384..10a6b756b 100644--- a/docs/docs/api/optimizers/MIPROv2.md+++ b/docs/docs/api/optimizers/MIPROv2.md@@ -1,5 +1,8 @@# dspy.MIPROv2+MIPROv2 optimizer optimizes instruction and also build few-shot examples.++<!-- START_API_REF -->::: dspy.MIPROv2handler: pythonoptions:@@ -14,3 +17,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/primitives/Example.md b/docs/docs/api/primitives/Example.mdindex 6634f73f7..1cfecea07 100644--- a/docs/docs/api/primitives/Example.md+++ b/docs/docs/api/primitives/Example.md@@ -1,5 +1,6 @@# dspy.Example+<!-- START_API_REF -->::: dspy.Examplehandler: pythonoptions:@@ -22,3 +23,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/primitives/History.md b/docs/docs/api/primitives/History.mdindex 409e30c84..3b5b717d0 100644--- a/docs/docs/api/primitives/History.md+++ b/docs/docs/api/primitives/History.md@@ -1,5 +1,6 @@# dspy.History+<!-- START_API_REF -->::: dspy.Historyhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/primitives/Image.md b/docs/docs/api/primitives/Image.mdindex 68a37b6e2..5cee56032 100644--- a/docs/docs/api/primitives/Image.md+++ b/docs/docs/api/primitives/Image.md@@ -1,5 +1,6 @@# dspy.Image+<!-- START_API_REF -->::: dspy.Imagehandler: pythonoptions:@@ -17,3 +18,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/primitives/Prediction.md b/docs/docs/api/primitives/Prediction.mdindex 0d0cb6442..9f78b2b2c 100644--- a/docs/docs/api/primitives/Prediction.md+++ b/docs/docs/api/primitives/Prediction.md@@ -1,5 +1,6 @@# dspy.Prediction+<!-- START_API_REF -->::: dspy.Predictionhandler: pythonoptions:@@ -25,3 +26,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/primitives/Tool.md b/docs/docs/api/primitives/Tool.mdindex ec482d5be..495939e1d 100644--- a/docs/docs/api/primitives/Tool.md+++ b/docs/docs/api/primitives/Tool.md@@ -1,10 +1,12 @@# dspy.Tool+<!-- START_API_REF -->::: dspy.Toolhandler: pythonoptions:members:- __call__+ - acallshow_source: trueshow_root_heading: trueheading_level: 2@@ -13,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/signatures/InputField.md b/docs/docs/api/signatures/InputField.mdindex b483f8ca0..f9b679d71 100644--- a/docs/docs/api/signatures/InputField.md+++ b/docs/docs/api/signatures/InputField.md@@ -1,5 +1,6 @@# dspy.InputField+<!-- START_API_REF -->::: dspy.InputFieldhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/signatures/OutputField.md b/docs/docs/api/signatures/OutputField.mdindex d5004428f..16a096ca2 100644--- a/docs/docs/api/signatures/OutputField.md+++ b/docs/docs/api/signatures/OutputField.md@@ -1,5 +1,6 @@# dspy.OutputField+<!-- START_API_REF -->::: dspy.OutputFieldhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/signatures/Signature.md b/docs/docs/api/signatures/Signature.mdindex af440c391..14e7db8ad 100644--- a/docs/docs/api/signatures/Signature.md+++ b/docs/docs/api/signatures/Signature.md@@ -1,5 +1,6 @@# dspy.Signature+<!-- START_API_REF -->::: dspy.Signaturehandler: pythonoptions:@@ -21,3 +22,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/tools/ColBERTv2.md b/docs/docs/api/tools/ColBERTv2.mdindex e24ea0a5c..9cfc13277 100644--- a/docs/docs/api/tools/ColBERTv2.md+++ b/docs/docs/api/tools/ColBERTv2.md@@ -1,5 +1,6 @@# dspy.ColBERTv2+<!-- START_API_REF -->::: dspy.ColBERTv2handler: pythonoptions:@@ -13,3 +14,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/tools/Embeddings.md b/docs/docs/api/tools/Embeddings.mdindex 16dcb6a24..9e5ac375c 100644--- a/docs/docs/api/tools/Embeddings.md+++ b/docs/docs/api/tools/Embeddings.md@@ -1,5 +1,6 @@# dspy.retrievers.Embeddings+<!-- START_API_REF -->::: dspy.retrievers.Embeddingshandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/tools/PythonInterpreter.md b/docs/docs/api/tools/PythonInterpreter.mdindex a4fa37aba..baf6af1cf 100644--- a/docs/docs/api/tools/PythonInterpreter.md+++ b/docs/docs/api/tools/PythonInterpreter.md@@ -1,5 +1,6 @@# dspy.PythonInterpreter+<!-- START_API_REF -->::: dspy.PythonInterpreterhandler: pythonoptions:@@ -15,3 +16,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/StatusMessage.md b/docs/docs/api/utils/StatusMessage.mdindex cbc57348e..161b7a13d 100644--- a/docs/docs/api/utils/StatusMessage.md+++ b/docs/docs/api/utils/StatusMessage.md@@ -1,5 +1,6 @@# dspy.streaming.StatusMessage+<!-- START_API_REF -->::: dspy.streaming.StatusMessagehandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/StatusMessageProvider.md b/docs/docs/api/utils/StatusMessageProvider.mdindex e375c3e83..19fac23ae 100644--- a/docs/docs/api/utils/StatusMessageProvider.md+++ b/docs/docs/api/utils/StatusMessageProvider.md@@ -1,5 +1,6 @@# dspy.streaming.StatusMessageProvider+<!-- START_API_REF -->::: dspy.streaming.StatusMessageProviderhandler: pythonoptions:@@ -18,3 +19,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/StreamListener.md b/docs/docs/api/utils/StreamListener.mdindex c6d8b800c..5785c6f12 100644--- a/docs/docs/api/utils/StreamListener.md+++ b/docs/docs/api/utils/StreamListener.md@@ -1,5 +1,6 @@# dspy.streaming.StreamListener+<!-- START_API_REF -->::: dspy.streaming.StreamListenerhandler: pythonoptions:@@ -14,3 +15,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/asyncify.md b/docs/docs/api/utils/asyncify.mdindex ed30423a1..b1fa70a88 100644--- a/docs/docs/api/utils/asyncify.md+++ b/docs/docs/api/utils/asyncify.md@@ -1,5 +1,6 @@# dspy.asyncify+<!-- START_API_REF -->::: dspy.asyncifyhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/disable_litellm_logging.md b/docs/docs/api/utils/disable_litellm_logging.mdindex 2fb8ca3c7..2d7b2a074 100644--- a/docs/docs/api/utils/disable_litellm_logging.md+++ b/docs/docs/api/utils/disable_litellm_logging.md@@ -1,5 +1,6 @@# dspy.disable_litellm_logging+<!-- START_API_REF -->::: dspy.disable_litellm_logginghandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/disable_logging.md b/docs/docs/api/utils/disable_logging.mdindex aa1bb1813..6bb9debbe 100644--- a/docs/docs/api/utils/disable_logging.md+++ b/docs/docs/api/utils/disable_logging.md@@ -1,5 +1,6 @@# dspy.disable_logging+<!-- START_API_REF -->::: dspy.disable_logginghandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/enable_litellm_logging.md b/docs/docs/api/utils/enable_litellm_logging.mdindex c1ca2ab1e..fa7f73705 100644--- a/docs/docs/api/utils/enable_litellm_logging.md+++ b/docs/docs/api/utils/enable_litellm_logging.md@@ -1,5 +1,6 @@# dspy.enable_litellm_logging+<!-- START_API_REF -->::: dspy.enable_litellm_logginghandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/enable_logging.md b/docs/docs/api/utils/enable_logging.mdindex 02f21e1f1..55ae12b02 100644--- a/docs/docs/api/utils/enable_logging.md+++ b/docs/docs/api/utils/enable_logging.md@@ -1,5 +1,6 @@# dspy.enable_logging+<!-- START_API_REF -->::: dspy.enable_logginghandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/inspect_history.md b/docs/docs/api/utils/inspect_history.mdindex 15736267f..81357c6d7 100644--- a/docs/docs/api/utils/inspect_history.md+++ b/docs/docs/api/utils/inspect_history.md@@ -1,5 +1,6 @@# dspy.inspect_history+<!-- START_API_REF -->::: dspy.inspect_historyhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/load.md b/docs/docs/api/utils/load.mdindex 9579e115e..dec1eaa57 100644--- a/docs/docs/api/utils/load.md+++ b/docs/docs/api/utils/load.md@@ -1,5 +1,6 @@# dspy.load+<!-- START_API_REF -->::: dspy.loadhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/docs/api/utils/streamify.md b/docs/docs/api/utils/streamify.mdindex 0bf842688..57e1f7ede 100644--- a/docs/docs/api/utils/streamify.md+++ b/docs/docs/api/utils/streamify.md@@ -1,5 +1,6 @@# dspy.streamify+<!-- START_API_REF -->::: dspy.streamifyhandler: pythonoptions:@@ -11,3 +12,4 @@show_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->diff --git a/docs/scripts/generate_api_docs.py b/docs/scripts/generate_api_docs.pyindex e7978806f..3b218972c 100644--- a/docs/scripts/generate_api_docs.py+++ b/docs/scripts/generate_api_docs.py@@ -134,8 +134,7 @@ def generate_doc_page(name: str, module_path: str, obj: Any, is_root: bool = Falmembers:{methods_list}"""- return f"""# {module_path}.{name}-+ return f"""<!-- START_API_REF -->::: {module_path}.{name}handler: pythonoptions:{members_config}@@ -147,6 +146,7 @@ def generate_doc_page(name: str, module_path: str, obj: Any, is_root: bool = Falshow_object_full_path: falseseparate_signature: falseinherited_members: true+<!-- END_API_REF -->"""@@ -157,6 +157,52 @@ def get_api_category(obj):return None+def read_existing_content(file_path: Path) -> tuple[str, str]:+ """Read existing file content and split into pre and post API reference sections.++ Returns:+ tuple[str, str]: (content_before_api_ref, content_after_api_ref)+ If file doesn't exist or no API ref section found, returns empty strings.+ """+ if not file_path.exists():+ return "", ""++ content = file_path.read_text()++ # Look for our specific API reference markers+ api_start_marker = "<!-- START_API_REF -->"+ api_end_marker = "<!-- END_API_REF -->"++ api_start = content.find(api_start_marker)+ if api_start == -1:+ # No API section found, treat all content as pre-content+ return content, ""++ api_end = content.find(api_end_marker)+ if api_end == -1:+ # Start marker found but no end marker - treat rest of file as post-content+ api_end = len(content)+ else:+ api_end = api_end + len(api_end_marker)++ return content[:api_start].rstrip(), content[api_end:].lstrip()+++def write_doc_file(file_path: Path, title: str, api_content: str):+ """Write documentation to file while preserving existing content."""+ pre_content, post_content = read_existing_content(file_path)++ # If no pre-content exists, add the title+ if not pre_content:+ pre_content = f"# {title}\n"++ # Combine all sections+ full_content = f"{pre_content}\n\n{api_content}\n{post_content}".strip() + "\n"++ # Write the combined content+ file_path.write_text(full_content)++def generate_md_docs(output_dir: Path, excluded_modules=None):"""Generate documentation for all public classes and functions in the dspy package.@@ -181,8 +227,8 @@ def generate_md_docs(output_dir: Path, excluded_modules=None):continuepage_content = generate_doc_page(name, "dspy", obj, is_root=True)- with open(output_dir / category / f"{name}.md", "w") as f:- f.write(page_content)+ file_path = output_dir / category / f"{name}.md"+ write_doc_file(file_path, f"dspy.{name}", page_content)objects_processed[f"{obj.__module__}.{name}"] = obj@@ -232,8 +278,8 @@ def generate_md_docs_submodule(module_path: str, output_dir: Path, objects_proceif full_name not in objects_processed:# Only generate docs for objects that are not root-level objects.page_content = generate_doc_page(name, module_path, obj, is_root=False)- with open(output_dir / category / f"{name}.md", "w") as f:- f.write(page_content)+ file_path = output_dir / category / f"{name}.md"+ write_doc_file(file_path, f"{module_path}.{name}", page_content)objects_processed[full_name] = obj@@ -254,19 +300,15 @@ def remove_empty_dirs(path: Path):if __name__ == "__main__":api_dir = Path("docs/api")- if api_dir.exists():- # Delete only subdirectories- for item in api_dir.iterdir():- if item.is_dir():- shutil.rmtree(item)-- for keys in API_MAPPING.keys():- # Create a directory for each API category- subpath = api_dir / keys+ api_dir.mkdir(parents=True, exist_ok=True)++ # Create category directories if they don't exist+ for category in API_MAPPING.keys():+ subpath = api_dir / categorysubpath.mkdir(parents=True, exist_ok=True)excluded_modules = ["dspy.dsp"]-generate_md_docs(api_dir, excluded_modules=excluded_modules)+# Clean up empty directoriesremove_empty_dirs(api_dir)