Repository Analysis

stanfordnlp/dspy

DSPy: The framework for programming—not prompting—language models

31.0 Strong AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of stanfordnlp/dspy, a Python project with 36,109 GitHub stars. SynthScan v2.0 examined 84,086 lines of code across 454 source files, recording 2035 pattern matches distributed across 24 syntactic categories. The overall adjusted score of 31.0 places this repository in the Strong AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

31.0
Adjusted Score
31.0
Raw Score
100%
Time Factor
2026-07-14
Last Push
36.1K
Stars
Python
Language
84.1K
Lines of Code
454
Files
2.0K
Pattern Hits
2026-07-14
Scan Date
0.15
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 1HIGH 65MEDIUM 189LOW 1780

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 2035 distinct pattern matches across 24 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers1124 hits · 1020 pts
SeverityFileLineSnippetContext
LOWdspy/propose/dataset_summary_generator.py30def order_input_keys_in_string(unordered_repr):CODE
LOWdspy/propose/propose_base.py9 def propose_instructions_for_program(self):CODE
LOWdspy/propose/propose_base.py12 def propose_instruction_for_predictor(self):CODE
LOWdspy/propose/utils.py22def create_instruction_set_history_string(base_program, trial_logs, top_n):CODE
LOWdspy/propose/utils.py58def parse_list_of_instructions(instruction_string):CODE
LOWdspy/propose/utils.py70def get_program_instruction_set_string(program):CODE
LOWdspy/propose/utils.py78def create_predictor_level_history_string(base_program, predictor_i, trial_logs, top_n):CODE
LOWdspy/propose/grounded_proposer.py64def generate_instruction_class(CODE
LOWdspy/propose/grounded_proposer.py155 def gather_examples_from_sets(candidate_sets, max_examples):CODE
LOWdspy/propose/grounded_proposer.py306 def propose_instructions_for_program(CODE
LOWdspy/propose/grounded_proposer.py366 def propose_instruction_for_predictor(CODE
LOWdspy/clients/base_lm.py208 def _declares_forward_contract(self) -> bool:CODE
LOWdspy/clients/base_lm.py228 def _validate_typed_lm_response(self, response: Any) -> LMResponse:CODE
LOWdspy/clients/base_lm.py237 def _validate_legacy_lm_response(CODE
LOWdspy/clients/base_lm.py267 def supports_function_calling(self) -> bool:CODE
LOWdspy/clients/base_lm.py466 def _legacy_prompt_from_items(self, items: tuple[Any, ...], *, prompt: str | None) -> str | None:CODE
LOWdspy/clients/base_lm.py510 def _legacy_forward_as_lm_response(self, request: LMRequest) -> LMResponse:CODE
LOWdspy/clients/base_lm.py526 async def _legacy_aforward_as_lm_response(self, request: LMRequest) -> LMResponse:CODE
LOWdspy/clients/base_lm.py542 def _legacy_outputs_to_lm_response(CODE
LOWdspy/clients/base_lm.py838 def _extract_citations_from_response(self, choice):CODE
LOWdspy/clients/embedding.py169def _cached_compute_embeddings(model, batch_inputs, caching=True, **kwargs):CODE
LOWdspy/clients/embedding.py185async def _cached_acompute_embeddings(model, batch_inputs, caching=True, **kwargs):CODE
LOWdspy/clients/__init__.py87def configure_litellm_logging(level: str = "ERROR"):CODE
LOWdspy/clients/utils_finetune.py131def find_data_errors_completion(data_dict: dict[str, str]) -> str | None:CODE
LOWdspy/clients/utils_finetune.py164def find_data_error_chat_message(message: dict[str, Any]) -> str | None:CODE
LOWdspy/clients/openai.py123 def is_terminal_training_status(status: TrainingStatus) -> bool:CODE
LOWdspy/clients/_litellm.py12def _configure_litellm_defaults(litellm: types.ModuleType) -> None:CODE
LOWdspy/clients/_litellm.py38def is_litellm_context_window_error(error: Exception) -> bool:CODE
LOWdspy/clients/lm.py47def _is_openai_reasoning_model(model: str) -> bool:CODE
LOWdspy/clients/lm.py148 def supports_function_calling(self) -> bool:CODE
LOWdspy/clients/lm.py172 def _get_cached_completion_fn(self, completion_fn, cache):CODE
LOWdspy/clients/lm.py447def _get_stream_completion_fn(CODE
LOWdspy/clients/lm.py588def litellm_responses_completion(request: dict[str, Any], num_retries: int, cache: dict[str, Any] | None = None):CODE
LOWdspy/clients/lm.py604async def alitellm_responses_completion(request: dict[str, Any], num_retries: int, cache: dict[str, Any] | None = None):CODE
LOWdspy/clients/lm.py620def _convert_chat_request_to_responses_request(request: dict[str, Any]):CODE
LOWdspy/clients/lm.py660def _convert_content_item_to_responses_format(item: dict[str, Any]) -> dict[str, Any]:CODE
LOWdspy/clients/lm.py700def _add_dspy_identifier_to_headers(headers: dict[str, Any] | None = None):CODE
LOWdspy/clients/lm.py711def _safe_litellm_exception_class(name: str) -> type[Exception] | None:CODE
LOWdspy/clients/lm.py716def _lm_error_class_from_litellm_exception(exc: Exception) -> type[LMError] | None:CODE
LOWdspy/clients/lm.py751def _lm_error_class_from_status(status: int | None) -> type[LMError]:CODE
LOWdspy/clients/databricks.py273def _create_directory_in_databricks_unity_catalog(w: "WorkspaceClient", databricks_unity_catalog_path: str):CODE
LOWdspy/clients/databricks.py346def _validate_completion_data(data: dict[str, Any]):CODE
LOWdspy/clients/openai_format.py123def to_openai_responses_request(request: LMRequest) -> dict[str, Any]:CODE
LOWdspy/clients/openai_format.py163def parts_to_responses_content(parts: list[Any]) -> list[dict[str, Any]]:CODE
LOWdspy/clients/openai_format.py170def tool_call_to_responses_input(tool_call_part: LMToolCallPart) -> dict[str, Any]:CODE
LOWdspy/clients/openai_format.py180def content_block_to_responses(block: dict[str, Any]) -> dict[str, Any]:CODE
LOWdspy/clients/openai_format.py536def completion_to_lm_response(response: Any, request: LMRequest) -> LMResponse:CODE
LOWdspy/clients/openai_format.py645def provider_tool_call_to_part(tool_call: Any) -> LMToolCallPart:CODE
LOWdspy/clients/openai_format.py661def responses_function_call_to_part(output_item: Any) -> LMToolCallPart:CODE
LOWdspy/clients/openai_format.py689def extract_citations_from_choice(choice: Any) -> list[LMCitationPart]:CODE
LOWdspy/clients/openai_format.py704def responses_annotations_to_citations(content_item: Any) -> list[LMCitationPart]:CODE
LOWdspy/clients/openai_format.py898def lm_response_from_legacy_outputs(outputs: list[dict[str, Any] | str | None], request: LMRequest) -> LMResponse:CODE
LOWdspy/clients/openai_format.py905def legacy_outputs_from_lm_response(response: LMResponse) -> list[dict[str, Any] | str | None]:CODE
LOWdspy/clients/openai_format.py138def message_to_responses_input_items(message: LMMessage) -> list[dict[str, Any]]:CODE
LOWdspy/clients/openai_format.py300def document_to_openai_blocks(document: LMDocumentPart) -> list[dict[str, Any]]:CODE
LOWdspy/clients/openai_format.py369def assistant_tool_call_to_openai(call: LMToolCallPart) -> dict[str, Any]:CODE
LOWdspy/clients/openai_format.py456def reasoning_to_responses_kwargs(reasoning: Any) -> dict[str, Any]:CODE
LOWdspy/clients/openai_format.py465def _validate_openai_reasoning_temperature(config: LMConfig, *, model: str | None, endpoint: str) -> None:CODE
LOWdspy/clients/openai_format.py488def _uses_max_completion_tokens(model: str | None) -> bool:CODE
LOWdspy/clients/openai_format.py492def _is_openai_reasoning_model(model: str | None) -> bool:CODE
1064 more matches not shown…
Docstring Block Structure47 hits · 235 pts
SeverityFileLineSnippetContext
HIGHdspy/clients/base_lm.py689Reconstruct an LM from `dump_state` output. Legacy states without a class marker load as `dspy.LM`. Custom LM STRING
HIGHdspy/clients/provider.py13A future representing an asynchronous model fine-tuning job. This class extends `concurrent.futures.Future` to reprSTRING
HIGHdspy/clients/provider.py82A job for reinforcement learning-based fine-tuning. This class represents a reinforcement learning fine-tuning job STRING
HIGHdspy/retrievers/embeddings.py151 Load the embeddings index from disk into the current instance. Args: path: Directory path STRING
HIGHdspy/retrievers/embeddings.py211 Create an Embeddings instance from a saved index. This is the recommended way to load saved embeddingsSTRING
HIGHdspy/core/types.py1286Create a system message for a direct LM call. A system message gives model-level instructions, such as tone, scope,STRING
HIGHdspy/core/types.py1324Create a developer message for a direct LM call. A developer message carries instructions that sit between system gSTRING
HIGHdspy/core/types.py1362Create a user message for a direct LM call. A user message contains the request or data you want the model to answeSTRING
HIGHdspy/core/types.py1446Create an assistant message for a direct LM call. An assistant message represents a previous model response. Use itSTRING
HIGHdspy/core/types.py1501Create a tool-result message for a direct LM call. A tool-result message sends the output of a tool back to the modSTRING
HIGHdspy/signatures/signature.py279Return a new Signature class with identical fields and new instructions. This method does not mutate `cls`. It STRING
HIGHdspy/signatures/signature.py308Return a new Signature class with identical fields and `instructions` appended to the existing instructions. ThSTRING
HIGHdspy/signatures/signature.py363Insert a field at index 0 of the `inputs` or `outputs` section. Args: name (str): Field name to addSTRING
HIGHdspy/signatures/signature.py390Insert a field at the end of the `inputs` or `outputs` section. Args: name (str): Field name to addSTRING
HIGHdspy/signatures/signature.py417Return a new Signature class without the given field. If `name` is not present, the fields are unchanged (no erSTRING
HIGHdspy/signatures/signature.py452Insert a field at a specific position among inputs or outputs. Negative indices are supported (e.g., `-1` appenSTRING
HIGHdspy/signatures/signature.py564Create a new Signature subclass with the specified fields and instructions. Args: signature: Either a strinSTRING
HIGHdspy/signatures/signature.py686Recursively parse an AST node representing a type annotation. This function converts Python's Abstract Syntax Tree STRING
HIGHdspy/streaming/streamify.py39 Wrap a DSPy program so that it streams its outputs incrementally, rather than returning them all at once. It alSTRING
HIGHdspy/primitives/code_interpreter.py110Execute Python code and return the result. Args: code: Python code to execute variablesSTRING
HIGHdspy/primitives/example.py224Mark which fields are inputs and return a new `Example`. Fields not listed here are treated as labels (expectedSTRING
HIGHdspy/primitives/module.py41Base class for all DSPy modules (programs). A Module is a building block for DSPy programs that can contain predictSTRING
HIGHdspy/primitives/module.py226Apply a function to all named predictors in this module. This method iterates through all Predict instances in STRING
HIGHdspy/primitives/module.py280 Processes a list of dspy.Example instances in parallel using the Parallel module. Args: exSTRING
HIGHdspy/adapters/types/citation.py92Convert a list of dictionaries to a Citations instance. Args: citations_dicts: A list of dictionariSTRING
HIGHdspy/adapters/types/tool.py220 Build a DSPy tool from a LangChain tool. Args: tool: The LangChain tool to convert. STRING
HIGHdspy/adapters/types/tool.py285Execute this individual tool call and return its result. Args: functions: Functions to searSTRING
HIGHdspy/adapters/types/tool.py346Convert a list of dictionaries to a ToolCalls instance. Args: dict_list: A list of dictionaries, whSTRING
HIGHdspy/adapters/types/image.py129 Encode an image or file to a base64 data URI. Args: image: The image or file to encode. Can be a PIL ISTRING
HIGHdspy/evaluate/metrics.py12Compute the Exact Match (EM) metric between a prediction and reference answers. Returns True if any reference exactSTRING
HIGHdspy/evaluate/metrics.py40Compute the maximum token-level F1 score against reference answers. Strings are normalized (same as in `EM`) and whSTRING
HIGHdspy/evaluate/metrics.py64Compute the maximum HotPotQA-style F1 score against reference answers. Like `F1`, but if either normalized side is STRING
HIGHdspy/evaluate/metrics.py88Normalize text for string and token comparisons. Steps: 1) Unicode NFD normalization 2) lowercasingSTRING
HIGHdspy/evaluate/metrics.py127Compute boolean exact match after normalization. Args: prediction (str): Predicted answer. ground_tSTRING
HIGHdspy/evaluate/metrics.py145Compute token-level F1 between prediction and reference (after normalization). Strings are normalized (see `normaliSTRING
HIGHdspy/evaluate/metrics.py184Compute HotPotQA-style token F1 with special labels. If either normalized string is in {"yes", "no", "noanswer"} anSTRING
HIGHdspy/evaluate/metrics.py222Compute token-level precision of prediction against reference (after normalization). Precision is (# overlapping toSTRING
HIGHdspy/evaluate/metrics.py286Evaluate exact match or F1-thresholded match for an example/prediction pair. If `example.answer` is a string, compaSTRING
HIGHdspy/evaluate/metrics.py321Return True if any passage in `pred.context` contains the answer(s). Strings are normalized (and passages also use STRING
HIGHdspy/evaluate/evaluate.py129 Args: program (dspy.Module): The DSPy program to evaluate. metric (Callable): The metriSTRING
HIGHdspy/predict/rlm.py672Execute RLM to produce outputs from the given inputs. Args: interpreter: Optional caller-owned inteSTRING
HIGHdspy/predict/rlm.py761Async version of forward(). Execute RLM to produce outputs. Args: interpreter: Optional caller-owneSTRING
HIGHdspy/predict/refine.py50 Refines a module by running it up to N times with different rollout IDs at `temperature=1.0` and returnSTRING
HIGHdspy/predict/best_of_n.py16 Runs a module up to `N` times with different rollout IDs at `temperature=1.0` and returns the best predSTRING
HIGHdspy/teleprompt/bettertogether.py211Compile and optimize a student program using a sequence of optimization strategies. Executes the optimizers speSTRING
HIGHdspy/teleprompt/gepa/gepa.py196 ... ``` GEPA can also be used as a batch inference-time search strategy, by passing `valset=trainset, STRING
HIGHtests/mock_interpreter.py75Execute code and return the next scripted response. Args: code: The code that would be executed (reSTRING
Unused Imports250 hits · 228 pts
SeverityFileLineSnippetContext
LOWdspy/__init__.py1CODE
LOWdspy/__init__.py2CODE
LOWdspy/__init__.py3CODE
LOWdspy/__init__.py4CODE
LOWdspy/__init__.py5CODE
LOWdspy/__init__.py7CODE
LOWdspy/__init__.py8CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py9CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py10CODE
LOWdspy/__init__.py22CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py23CODE
LOWdspy/__init__.py43CODE
LOWdspy/__init__.py43CODE
LOWdspy/__init__.py44CODE
LOWdspy/__init__.py45CODE
LOWdspy/__init__.py47CODE
LOWdspy/__init__.py48CODE
LOWdspy/__init__.py51CODE
LOWdspy/__init__.py53CODE
LOWdspy/__init__.py53CODE
190 more matches not shown…
Decorative Section Separators63 hits · 220 pts
SeverityFileLineSnippetContext
MEDIUMdspy/clients/openai_format.py114# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py120# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py527# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py533# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py798# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py800# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py888# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py895# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py66# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py73# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py203# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py208# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py231# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/clients/openai_format.py237# ---------------------------------------------------------------------------COMMENT
MEDIUMdspy/primitives/python_interpreter.py35# =============================================================================COMMENT
MEDIUMdspy/primitives/python_interpreter.py37# =============================================================================COMMENT
MEDIUMdspy/predict/rlm.py182 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py184 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py312 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py314 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py366 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py368 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py452 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py454 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py509 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py511 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py667 # =========================================================================COMMENT
MEDIUMdspy/predict/rlm.py669 # =========================================================================COMMENT
MEDIUMtests/primitives/test_python_interpreter.py359# =============================================================================COMMENT
MEDIUMtests/primitives/test_python_interpreter.py361# =============================================================================COMMENT
MEDIUMtests/primitives/test_python_interpreter.py747# =============================================================================COMMENT
MEDIUMtests/primitives/test_python_interpreter.py749# =============================================================================COMMENT
MEDIUMtests/primitives/test_python_interpreter.py847# =============================================================================COMMENT
MEDIUMtests/primitives/test_python_interpreter.py849# =============================================================================COMMENT
MEDIUMtests/primitives/test_python_interpreter.py551# =============================================================================COMMENT
MEDIUMtests/primitives/test_python_interpreter.py553# =============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py117# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py119# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py869# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py871# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1192# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1194# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py23# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py25# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py80# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py82# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1148# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1150# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1279# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1281# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1423# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1425# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1457# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1459# ============================================================================COMMENT
MEDIUMtests/predict/test_rlm.py1061# ============================================================================STRING
MEDIUMtests/predict/test_rlm.py1063# ============================================================================STRING
MEDIUMtests/teleprompt/test_bettertogether.py103# ============================================================================COMMENT
MEDIUMtests/teleprompt/test_bettertogether.py105# ============================================================================COMMENT
MEDIUMtests/teleprompt/test_bettertogether.py41# ============================================================================COMMENT
MEDIUMtests/teleprompt/test_bettertogether.py43# ============================================================================COMMENT
3 more matches not shown…
Self-Referential Comments67 hits · 188 pts
SeverityFileLineSnippetContext
MEDIUMdspy/propose/grounded_proposer.py314 """This method is responsible for returning the full set of new instructions for our program, given the specifieSTRING
MEDIUMdspy/propose/grounded_proposer.py334 # Create an instruction for each predictorCOMMENT
MEDIUMdspy/propose/grounded_proposer.py376 """This method is responsible for returning a single instruction for a given predictor, using the specified critSTRING
MEDIUMdspy/propose/grounded_proposer.py378 # Create an instruction history string for our predictorCOMMENT
MEDIUMdspy/clients/cache.py248 # Create a modified request that includes the function identifier so that it's incorporated into the cacheCOMMENT
MEDIUMdspy/clients/databricks.py299 # Create the directory if it doesn't exist, we don't raise an error because this is a common case.COMMENT
MEDIUMdspy/retrievers/embeddings.py234 # Create a minimal instance without triggering embedding computationCOMMENT
MEDIUMdspy/retrievers/databricks_rm.py44 # Create a Databricks Vector Search EndpointSTRING
MEDIUMdspy/retrievers/databricks_rm.py51 # Create a Databricks Direct Access Vector Search IndexSTRING
MEDIUMdspy/retrievers/databricks_rm.py66 # Create a DatabricksRM retriever module to query the Databricks Direct Access VectorSTRING
MEDIUMdspy/streaming/streamify.py72 # Create the program and wrap it with streaming functionalitySTRING
MEDIUMdspy/streaming/streamify.py104 # Create the program and wrap it with streaming functionalitySTRING
MEDIUMdspy/streaming/streamify.py130 # Create the program and wrap it with streaming functionalitySTRING
MEDIUMdspy/primitives/base_module.py123 # Create an empty instance.COMMENT
MEDIUMdspy/primitives/base_module.py211 # Create the directory (and any parent directories)COMMENT
MEDIUMdspy/primitives/module.py22 # Create the instance without invoking ``__init__`` so we can injectCOMMENT
MEDIUMdspy/primitives/module.py297 # Create a list of execution pairs (self, example)COMMENT
MEDIUMdspy/primitives/module.py300 # Create an instance of ParallelCOMMENT
MEDIUMdspy/adapters/two_step_adapter.py67 # Create a task description for the main LMCOMMENT
MEDIUMdspy/adapters/types/tool.py140 # Create a pydantic model wrapper with a dummy field `value` to parse the arg to the correct type.COMMENT
MEDIUMdspy/predict/refine.py72 # Define a QA module with chain of thoughtSTRING
MEDIUMdspy/predict/refine.py75 # Define a reward function that checks for one-word answersSTRING
MEDIUMdspy/predict/refine.py79 # Create a refined module that tries up to 3 timesSTRING
MEDIUMdspy/predict/code_act.py113 # Define the tool functions in the interpreterCOMMENT
MEDIUMdspy/predict/best_of_n.py34 # Define a QA module with chain of thoughtSTRING
MEDIUMdspy/predict/best_of_n.py37 # Define a reward function that checks for one-word answersSTRING
MEDIUMdspy/predict/best_of_n.py41 # Create a refined module that tries up to 3 timesSTRING
MEDIUMdspy/predict/knn.py23 # Create a training dataset with examplesSTRING
MEDIUMdspy/teleprompt/knn_fewshot.py29 # Define a QA module with chain of thoughtSTRING
MEDIUMdspy/teleprompt/knn_fewshot.py32 # Create a training dataset with examplesSTRING
MEDIUMdspy/teleprompt/utils.py39 # Create the mini-batch using the sampled indicesCOMMENT
MEDIUMdspy/teleprompt/utils.py220 # Define the save path for the programCOMMENT
MEDIUMdspy/teleprompt/utils.py248 # Create a loggerCOMMENT
MEDIUMdspy/teleprompt/utils.py252 # Create a file handler that logs debug and higher level messagesCOMMENT
MEDIUMdspy/teleprompt/utils.py259 # Create a console handler with a higher log levelCOMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py548 # Initialize optimization variablesCOMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py556 # Define the objective functionCOMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py568 # Create a new candidate programCOMMENT
MEDIUMdspy/teleprompt/gepa/instruction_proposal.py82 # Create a rich multimodal examples_with_feedback that includes both text and imagesCOMMENT
MEDIUMtests/clients/test_cache.py244 # Define a test functionCOMMENT
MEDIUMtests/clients/test_cache.py301 # Define a test functionCOMMENT
MEDIUMtests/clients/test_cache.py328 # Define a test functionCOMMENT
MEDIUMtests/clients/test_cache.py215 # Create a new cache instance with disk cache disabledCOMMENT
MEDIUMtests/clients/test_cache.py271 # Define a test functionCOMMENT
MEDIUMtests/test_utils/server/__init__.py24 # Create a server log file used to store request logsCOMMENT
MEDIUMtests/signatures/test_adapter_image.py346 # Create a dspy.Image object from the PDF URL with download=TrueCOMMENT
MEDIUMtests/signatures/test_adapter_image.py424 # Create a dspy.Image from the fileCOMMENT
MEDIUMtests/utils/test_saving.py96 # Create a custom handler to capture log messagesCOMMENT
MEDIUMtests/utils/test_settings.py127 # Define the coroutines to be runCOMMENT
MEDIUMtests/utils/test_settings.py225 # Create a temporary Python file with our custom moduleCOMMENT
MEDIUMtests/primitives/test_python_interpreter.py856 # Create a string just over the thresholdCOMMENT
MEDIUMtests/primitives/test_python_interpreter.py868 # Create a string with recognizable pattern just over thresholdCOMMENT
MEDIUMtests/primitives/test_base_module.py135 # Create a temporary Python file with our custom moduleCOMMENT
MEDIUMtests/primitives/test_base_module.py202 # Create a custom handler to capture log messagesSTRING
MEDIUMtests/predict/test_rlm.py644 # Create a field with description and constraintsCOMMENT
MEDIUMtests/predict/test_predict.py607 # Define a model for datetime inputs and outputsCOMMENT
MEDIUMtests/predict/test_predict.py1764 # Create an instance of the Query modelCOMMENT
MEDIUMtests/predict/test_react.py215 # Create a simple tool for testingCOMMENT
MEDIUMtests/reliability/generate/utils.py297 # Create a GeneratedTestCase object and add it to the listCOMMENT
MEDIUMtests/teleprompt/test_copro_optimizer.py7# Define a simple metric function for testingCOMMENT
7 more matches not shown…
Excessive Try-Catch Wrapping120 hits · 139 pts
SeverityFileLineSnippetContext
LOWdspy/propose/dataset_summary_generator.py82 except Exception as e:CODE
LOWdspy/propose/grounded_proposer.py222 except Exception as e:CODE
MEDIUMdspy/propose/grounded_proposer.py224 print(f"Error getting program description. Running without program aware proposer. Error: {e}")CODE
LOWdspy/propose/grounded_proposer.py289 except Exception as e:CODE
MEDIUMdspy/propose/grounded_proposer.py290 print(f"Error getting source code: {e}.\n\nRunning without program aware proposer.")CODE
LOWdspy/propose/grounded_proposer.py301 except Exception as e:CODE
MEDIUMdspy/propose/grounded_proposer.py302 print(f"Error getting data summary: {e}.\n\nRunning without data aware proposer.")CODE
LOWdspy/clients/base_lm.py853 except Exception:CODE
LOWdspy/clients/disk_serialization.py64 except Exception as e:CODE
LOWdspy/clients/lm_local.py222 except Exception:CODE
MEDIUMdspy/clients/lm_local.py200def train_sft_locally(model_name, train_data, train_kwargs):CODE
LOWdspy/clients/cache.py121 except Exception:CODE
LOWdspy/clients/cache.py172 except Exception:CODE
LOWdspy/clients/cache.py183 except Exception as e:CODE
LOWdspy/clients/__init__.py71 except Exception as e:CODE
LOWdspy/clients/openai.py109 except Exception:CODE
LOWdspy/clients/openai.py119 except Exception:CODE
LOWdspy/clients/lm.py257 except Exception as e:CODE
LOWdspy/clients/lm.py315 except Exception as e:CODE
LOWdspy/clients/lm.py394 except Exception as err:CODE
LOWdspy/clients/databricks.py159 except Exception:CODE
LOWdspy/clients/databricks.py259 except Exception as e:CODE
LOWdspy/clients/databricks.py289 except Exception:CODE
LOWdspy/clients/databricks.py298 except Exception:CODE
MEDIUMdspy/clients/databricks.py263def _get_workspace_client() -> "WorkspaceClient":CODE
LOWdspy/clients/openai_format.py653 except Exception as error:CODE
LOWdspy/clients/openai_format.py668 except Exception as error:CODE
LOWdspy/clients/openai_format.py699 except Exception:CODE
LOWdspy/clients/openai_format.py790 except Exception:CODE
LOWdspy/utils/callback.py271 except Exception as e:CODE
LOWdspy/utils/callback.py283 except Exception as e:CODE
LOWdspy/utils/callback.py311 except Exception as e:CODE
LOWdspy/utils/callback.py341 except Exception as e:CODE
LOWdspy/utils/magicattr.py25 except Exception as ex:CODE
LOWdspy/utils/parallelizer.py60 except Exception as e:CODE
LOWdspy/utils/parallelizer.py191 except Exception:CODE
LOWdspy/utils/langchain_tool.py26 except Exception as e:CODE
MEDIUMdspy/utils/langchain_tool.py22def func(**kwargs):CODE
LOWdspy/utils/lazy_import.py113 except Exception:CODE
LOWdspy/utils/unbatchify.py47 except Exception as e:CODE
LOWdspy/utils/unbatchify.py72 except Exception as e:CODE
LOWdspy/streaming/streaming_listener.py161 except Exception:CODE
LOWdspy/streaming/streaming_listener.py369 except Exception:CODE
MEDIUMdspy/streaming/streaming_listener.py366def _output_type(self) -> type | None:CODE
LOWdspy/primitives/python_interpreter.py285 except Exception:CODE
LOWdspy/primitives/python_interpreter.py394 except Exception as e:CODE
LOWdspy/primitives/base_module.py120 except Exception:CODE
LOWdspy/primitives/base_module.py133 except Exception:CODE
LOWdspy/primitives/base_module.py141 except Exception:CODE
LOWdspy/primitives/base_module.py222 except Exception as e:CODE
LOWdspy/primitives/base_module.py238 except Exception as e:CODE
LOWdspy/adapters/chat_adapter.py86 except Exception as e:CODE
LOWdspy/adapters/chat_adapter.py106 except Exception as e:CODE
LOWdspy/adapters/chat_adapter.py238 except Exception as e:CODE
LOWdspy/adapters/xml_adapter.py111 except Exception as e:CODE
LOWdspy/adapters/_legacy_type_markers.py86 except Exception:CODE
LOWdspy/adapters/utils.py41 except Exception:CODE
LOWdspy/adapters/utils.py196 except Exception:CODE
LOWdspy/adapters/json_adapter.py89 except Exception:CODE
LOWdspy/adapters/json_adapter.py116 except Exception:CODE
60 more matches not shown…
Modern AI Meta-Vocabulary39 hits · 114 pts
SeverityFileLineSnippetContext
MEDIUMdspy/adapters/base.py382 # Begin few-shot examplesSTRING
MEDIUMdspy/adapters/base.py388 # End few-shot examplesSTRING
MEDIUMdspy/predict/refine.py72 # Define a QA module with chain of thoughtSTRING
MEDIUMdspy/predict/best_of_n.py34 # Define a QA module with chain of thoughtSTRING
MEDIUMdspy/teleprompt/knn_fewshot.py29 # Define a QA module with chain of thoughtSTRING
MEDIUMdspy/teleprompt/knn_fewshot.py45 # Compile the QA module with few-shot learningSTRING
MEDIUMdspy/teleprompt/random_search.py74 # zero-shotCOMMENT
MEDIUMdspy/teleprompt/random_search.py83 # unshuffled few-shotCOMMENT
MEDIUMdspy/teleprompt/random_search.py157# Alternatively, we can keep track of the (zero-shot) number of tokens when we bootstrap.COMMENT
MEDIUMdspy/teleprompt/utils.py365 # zero-shotCOMMENT
MEDIUMdspy/teleprompt/utils.py378 # unshuffled few-shotCOMMENT
MEDIUMdspy/teleprompt/utils.py391 # shuffled few-shotCOMMENT
MEDIUMdspy/teleprompt/copro_optimizer.py149 # Seed the prompt optimizer zero shot with just the instruction, generate BREADTH new promptsCOMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py230 # Step 1: Bootstrap few-shot examplesCOMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py256 # If zero-shot, discard demosCOMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py309 # Set num instruct candidates to 1/2 of N if optimizing with few-shot examples, otherwise set to NCOMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py310 # This is because we've found that it's generally better to spend optimization budget on few-shot examplesCOMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py283 num_vars *= 2 # Account for few-shot examples + instruction variablesCODE
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py448 # logger.info(f"!!!!\n\n\n\n\nError generating few-shot examples: {e}")COMMENT
MEDIUMdspy/teleprompt/mipro_optimizer_v2.py449 # logger.info("Running without few-shot examples.!!!!\n\n\n\n\n")COMMENT
MEDIUMtests/adapters/test_json_adapter.py983 # 1 system message, 2 few shot examples (1 user and assistant message for each example), 1 user messageCOMMENT
MEDIUMtests/adapters/test_json_adapter.py1076 # Image information in the few-shot example's user messageCOMMENT
MEDIUMtests/adapters/test_chat_adapter.py2128 # 1 system message, 2 few shot examples (1 user and assistant message for each example), 1 user messageCOMMENT
MEDIUMtests/adapters/test_chat_adapter.py2193 # Image information in the few-shot example's user messageCOMMENT
MEDIUMtests/adapters/test_xml_adapter.py214 # Image information in the few-shot example's user messageSTRING
MEDIUMtests/predict/test_react.py237 # The 3rd call raises context window exceeded errorCOMMENT
MEDIUMtests/examples/test_baleen.py62 # Ask any question you like to this simple RAG program.COMMENT
MEDIUMtests/examples/test_baleen.py66 uncompiled_baleen = SimplifiedBaleen() # uncompiled (i.e., zero-shot) programCODE
MEDIUMtests/examples/test_baleen.py103 uncompiled_baleen = SimplifiedBaleen() # uncompiled (i.e., zero-shot) programCODE
MEDIUMtests/teleprompt/test_utils.py84 # Find the call where seed == -1 (unshuffled few-shot)COMMENT
MEDIUMdocs/overrides/home.html337 <div class="line"><span class="tok-cm"># Baseline 62% (gpt-5.4-mini, zero-shot)</span></div>CODE
MEDIUMdocs/docs/getting-started/react-and-tools.md72## ReAct manages an agentic loopCOMMENT
MEDIUMdocs/docs/api/optimizers/GEPA/GEPA_Advanced.md173#### Advanced Example: RAG-Enhanced Instruction ProposerCOMMENT
MEDIUMdocs/docs/tutorials/build_ai_program/index.md16## Retrieval-Augmented Generation (RAG)COMMENT
MEDIUMdocs/docs/tutorials/build_ai_program/index.md18### [Retrieval-Augmented Generation (RAG)](../rag/index.ipynb)COMMENT
MEDIUMdocs/docs/tutorials/build_ai_program/index.md21### [Building RAG as Agent](../agents/index.ipynb)COMMENT
MEDIUMdocs/docs/tutorials/build_ai_program/index.md24### [Multi-Hop RAG](../multihop_search/index.ipynb)COMMENT
MEDIUMdocs/docs/community/community-resources.md24| **Building Self-improving Agents in Production with DSPy** | [Link](https://relevanceai.com/blog/building-self-improviCODE
MEDIUMdocs/docs/community/use-cases.md60| **[Moody's](https://www.moodys.com/)** | Leveraging DSPy to optimize RAG systems, LLM-as-a-Judge, and agentic systems CODE
Structural Annotation Overuse49 hits · 88 pts
SeverityFileLineSnippetContext
LOWdspy/signatures/signature.py830 # Step 1: Convert camelCase to snake_caseCOMMENT
LOWdspy/signatures/signature.py838 # Step 2: Handle numbers by adding underscores around themCOMMENT
LOWdspy/signatures/signature.py852 # Step 3: Convert to Title Case while preserving acronymsCOMMENT
LOWdspy/teleprompt/mipro_optimizer_v2.py230 # Step 1: Bootstrap few-shot examplesCOMMENT
LOWdspy/teleprompt/mipro_optimizer_v2.py261 # Step 3: Find optimal prompt parametersCOMMENT
LOWdspy/teleprompt/mipro_optimizer_v2.py243 # Step 2: Propose instruction candidatesCOMMENT
LOWdocs/docs/api/modules/RLM.md64##### Step 1: Initial Metadata (no direct access to full context)COMMENT
LOWdocs/docs/api/modules/RLM.md66# Step 1: Peek at the dataCOMMENT
LOWdocs/docs/api/modules/RLM.md74##### Step 2: Write Code to Explore ContextCOMMENT
LOWdocs/docs/api/modules/RLM.md76# Step 2: Search for relevant sectionsCOMMENT
LOWdocs/docs/api/modules/RLM.md86##### Step 3: Trigger Sub-LLM CallsCOMMENT
LOWdocs/docs/api/modules/RLM.md88# Step 3: Use sub-LLM for semantic extractionCOMMENT
LOWdocs/docs/api/modules/RLM.md97##### Step 4: Submit Final AnswerCOMMENT
LOWdocs/docs/api/modules/RLM.md99# Step 4: Return final answerCOMMENT
LOWdocs/docs/tutorials/mem0_react_agent/index.md27## Step 1: Understanding Mem0 IntegrationCOMMENT
LOWdocs/docs/tutorials/mem0_react_agent/index.md59## Step 2: Create Memory-Aware ToolsCOMMENT
LOWdocs/docs/tutorials/mem0_react_agent/index.md129## Step 3: Build the Memory-Enhanced ReAct AgentCOMMENT
LOWdocs/docs/tutorials/mem0_react_agent/index.md198## Step 4: Running the Memory-Enhanced AgentCOMMENT
LOWdocs/docs/tutorials/sample_code_generation/index.md21## Step 1: Documentation Fetching and ProcessingCOMMENT
LOWdocs/docs/tutorials/sample_code_generation/index.md198## Step 2: Learning from Documentation URLsSTRING
LOWdocs/docs/tutorials/sample_code_generation/index.md243## Step 3: Generating Code ExamplesCOMMENT
LOWdocs/docs/tutorials/sample_code_generation/index.md318## Step 4: Interactive Library Learning FunctionCOMMENT
LOWdocs/docs/tutorials/sample_code_generation/index.md335 # Step 1: Learn from documentationCOMMENT
LOWdocs/docs/tutorials/sample_code_generation/index.md338 # Step 2: Generate examples for each use caseCOMMENT
LOWdocs/docs/tutorials/optimizer_tracking/index.md104#### Step 1: Access the MLflow UICOMMENT
LOWdocs/docs/tutorials/optimizer_tracking/index.md107#### Step 2: Understanding the Experiment StructureCOMMENT
LOWdocs/docs/tutorials/optimizer_tracking/index.md112#### Step 3: Analyzing the Parent RunCOMMENT
LOWdocs/docs/tutorials/optimizer_tracking/index.md117#### Step 4: Examining Child RunsCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md64## Step 1: Define Our Data StructuresCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md97## Step 2: Create DSPy SignaturesCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md147## Step 3: Build the Email Processing ModuleCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md167 # Step 1: Classify the emailCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md174 # Step 2: Extract entitiesCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md181 # Step 3: Generate summaryCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md188 # Step 4: Determine actionsCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md196 # Step 5: Structure the resultsCOMMENT
LOWdocs/docs/tutorials/email_extraction/index.md213## Step 4: Running the Email Processing SystemCOMMENT
LOWdocs/docs/tutorials/ai_text_game/index.md21## Step 1: Core Game FrameworkCOMMENT
LOWdocs/docs/tutorials/ai_text_game/index.md168## Step 2: AI-Powered Story GenerationCOMMENT
LOWdocs/docs/tutorials/ai_text_game/index.md297## Step 3: Game Interface and InteractionCOMMENT
LOWdocs/docs/tutorials/ai_text_game/index.md405## Step 4: Main Game LoopSTRING
LOWdocs/docs/tutorials/yahoo_finance_react/index.md15## Step 1: Convert LangChain Tool to DSPyCOMMENT
LOWdocs/docs/tutorials/yahoo_finance_react/index.md33## Step 2: Create Supporting Financial ToolsCOMMENT
LOWdocs/docs/tutorials/yahoo_finance_react/index.md88## Step 3: Build the Financial ReAct AgentCOMMENT
LOWdocs/docs/tutorials/yahoo_finance_react/index.md115## Step 4: Run Financial AnalysisCOMMENT
LOWdocs/docs/tutorials/llms_txt_generation/index.md19### Step 1: Define Our SignaturesCOMMENT
LOWdocs/docs/tutorials/llms_txt_generation/index.md59### Step 2: Create the Repository Analyzer ModuleCOMMENT
LOWdocs/docs/tutorials/llms_txt_generation/index.md107### Step 3: Gather Repository InformationCOMMENT
LOWdocs/docs/tutorials/llms_txt_generation/index.md173### Step 4: Configure DSPy and Generate llms.txtCOMMENT
Deep Nesting97 hits · 87 pts
SeverityFileLineSnippetContext
LOWdspy/propose/dataset_summary_generator.py48CODE
LOWdspy/propose/utils.py146CODE
LOWdspy/propose/grounded_proposer.py144CODE
LOWdspy/propose/grounded_proposer.py306CODE
LOWdspy/propose/grounded_proposer.py155CODE
LOWdspy/clients/base_lm.py856CODE
LOWdspy/clients/cache.py24CODE
LOWdspy/clients/cache.py48CODE
LOWdspy/clients/lm.py620CODE
LOWdspy/clients/databricks.py305CODE
LOWdspy/clients/databricks.py51CODE
LOWdspy/clients/openai_format.py577CODE
LOWdspy/clients/openai_format.py776CODE
LOWdspy/retrievers/weaviate_rm.py73CODE
LOWdspy/retrievers/weaviate_rm.py113CODE
LOWdspy/core/types.py1576CODE
LOWdspy/core/types.py1635CODE
LOWdspy/core/types.py1791CODE
LOWdspy/core/types.py259CODE
LOWdspy/core/types.py1182CODE
LOWdspy/signatures/signature.py54CODE
LOWdspy/signatures/signature.py138CODE
LOWdspy/datasets/hotpotqa.py7CODE
LOWdspy/datasets/math.py36CODE
LOWdspy/datasets/alfworld/alfworld.py6CODE
LOWdspy/utils/annotation.py39CODE
LOWdspy/utils/magicattr.py117CODE
LOWdspy/utils/parallelizer.py105CODE
LOWdspy/utils/inspect_history.py27CODE
LOWdspy/utils/unbatchify.py51CODE
LOWdspy/streaming/streaming_listener.py241CODE
LOWdspy/streaming/streaming_listener.py312CODE
LOWdspy/streaming/streamify.py31CODE
LOWdspy/streaming/streamify.py179CODE
LOWdspy/primitives/example.py324CODE
LOWdspy/primitives/example.py335CODE
LOWdspy/primitives/python_interpreter.py502CODE
LOWdspy/primitives/python_interpreter.py545CODE
LOWdspy/primitives/base_module.py23CODE
LOWdspy/primitives/base_module.py69CODE
LOWdspy/primitives/base_module.py110CODE
LOWdspy/primitives/base_module.py34CODE
LOWdspy/adapters/utils.py93CODE
LOWdspy/adapters/json_adapter.py231CODE
LOWdspy/adapters/json_adapter.py275CODE
LOWdspy/adapters/base.py137CODE
LOWdspy/adapters/base.py280CODE
LOWdspy/adapters/base.py625CODE
LOWdspy/adapters/baml_adapter.py89CODE
LOWdspy/adapters/types/base_type.py135CODE
LOWdspy/adapters/types/citation.py133CODE
LOWdspy/adapters/types/citation.py182CODE
LOWdspy/adapters/types/audio.py125CODE
LOWdspy/adapters/types/tool.py392CODE
LOWdspy/adapters/types/tool.py284CODE
LOWdspy/adapters/types/image.py128CODE
LOWdspy/adapters/types/image.py239CODE
LOWdspy/predict/predict.py398CODE
LOWdspy/predict/predict.py141CODE
LOWdspy/predict/refine.py98CODE
37 more matches not shown…
Modern Structural Boilerplate58 hits · 58 pts
SeverityFileLineSnippetContext
LOWdspy/propose/__init__.py3__all__ = [CODE
LOWdspy/clients/lm_local.py19logger = logging.getLogger(__name__)CODE
LOWdspy/clients/cache.py21logger = logging.getLogger(__name__)CODE
LOWdspy/clients/__init__.py13logger = logging.getLogger(__name__)CODE
LOWdspy/clients/__init__.py113__all__ = [CODE
LOWdspy/clients/lm.py40logger = logging.getLogger(__name__)CODE
LOWdspy/clients/databricks.py16logger = logging.getLogger(__name__)CODE
LOWdspy/clients/openai_format.py54__all__ = [CODE
LOWdspy/experimental/__init__.py4__all__ = [CODE
LOWdspy/retrievers/__init__.py4__all__ = ["Embeddings", "EmbeddingsWithScores", "Retrieve"]CODE
LOWdspy/core/types.py17__all__ = [CODE
LOWdspy/signatures/__init__.py10__all__ = [CODE
LOWdspy/datasets/__init__.py8__all__ = [CODE
LOWdspy/utils/callback.py12logger = logging.getLogger(__name__)CODE
LOWdspy/utils/parallelizer.py13logger = logging.getLogger(__name__)CODE
LOWdspy/utils/saving.py12logger = logging.getLogger(__name__)CODE
LOWdspy/utils/__init__.py26__all__ = [CODE
LOWdspy/streaming/__init__.py5__all__ = [CODE
LOWdspy/streaming/streamify.py19logger = logging.getLogger(__name__)CODE
LOWdspy/primitives/repl_types.py23__all__ = ["REPLVariable", "REPLEntry", "REPLHistory"]CODE
LOWdspy/primitives/__init__.py9__all__ = [CODE
LOWdspy/primitives/python_interpreter.py27__all__ = ["PythonInterpreter", "FinalOutput", "CodeExecutionError", "CodeInterpreterError"]CODE
LOWdspy/primitives/python_interpreter.py29logger = logging.getLogger(__name__)CODE
LOWdspy/primitives/base_module.py16logger = logging.getLogger(__name__)CODE
LOWdspy/primitives/module.py15logger = logging.getLogger(__name__)CODE
LOWdspy/primitives/sandbox_serializable.py38__all__ = ["SandboxSerializable", "build_repl_variable"]CODE
LOWdspy/adapters/__init__.py8__all__ = [CODE
LOWdspy/adapters/json_adapter.py24logger = logging.getLogger(__name__)CODE
LOWdspy/adapters/base.py28logger = logging.getLogger(__name__)CODE
LOWdspy/adapters/types/__init__.py10__all__ = ["History", "Image", "Audio", "File", "Type", "Tool", "ToolCalls", "ToolCallResults", "Code", "Reasoning"]CODE
LOWdspy/evaluate/__init__.py5__all__ = [CODE
LOWdspy/evaluate/evaluate.py45logger = logging.getLogger(__name__)CODE
LOWdspy/predict/rlm.py49logger = logging.getLogger(__name__)CODE
LOWdspy/predict/react.py10logger = logging.getLogger(__name__)CODE
LOWdspy/predict/predict.py19logger = logging.getLogger(__name__)CODE
LOWdspy/predict/__init__.py15__all__ = [CODE
LOWdspy/predict/react_v2.py16logger = logging.getLogger(__name__)CODE
LOWdspy/predict/code_act.py13logger = logging.getLogger(__name__)CODE
LOWdspy/predict/program_of_thought.py20logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/bootstrap_trace.py13logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/bootstrap.py33logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/bettertogether.py22logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/__init__.py19__all__ = [CODE
LOWdspy/teleprompt/grpo.py23logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/utils.py24logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/bootstrap_finetune.py17logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/copro_optimizer.py10logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/simba.py14logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/mipro_optimizer_v2.py25logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/simba_utils.py12logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/infer_rules.py9logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/gepa/gepa.py18logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/gepa/__init__.py3__all__ = ["GEPA"]CODE
LOWdspy/teleprompt/gepa/instruction_proposal.py10logger = logging.getLogger(__name__)CODE
LOWdspy/teleprompt/gepa/gepa_utils.py17logger = logging.getLogger(__name__)CODE
LOWdspy/dsp/utils/settings.py13logger = logging.getLogger(__name__)CODE
LOWdspy/dsp/utils/dpr.py13logger = logging.getLogger(__name__)CODE
LOWtests/mock_interpreter.py15__all__ = ["MockInterpreter", "MockInterpreterFactory"]CODE
Cross-Language Confusion9 hits · 50 pts
SeverityFileLineSnippetContext
HIGHdspy/teleprompt/bootstrap.py121 assert predictor1.signature.equals(CODE
HIGHdspy/teleprompt/gepa/gepa_utils.py224 trace_instances = [t for t in trace if t[0].signature.equals(module.signature)]STRING
HIGHtests/signatures/test_signature.py146 assert sig1.equals(sig2)CODE
HIGHtests/signatures/test_signature.py152 assert not sig1.equals(sig2)CODE
HIGHtests/signatures/test_signature.py160 assert TestSignature.equals(TestSignature)CODE
HIGHtests/signatures/test_signature.py515 assert sig1.equals(sig2)CODE
HIGHtests/signatures/test_signature.py557 assert Sig1.equals(Sig2)CODE
HIGHtests/adapters/test_chat_adapter.py796 '{"type": "null"}], "default": null, "title": "Document Title"}, "end_char_index": 'CODE
HIGHtests/adapters/test_chat_adapter.py799 '"string"}, {"type": "null"}], "default": null, "title": "Supported Text"}}, 'CODE
Redundant / Tautological Comments18 hits · 25 pts
SeverityFileLineSnippetContext
LOWdspy/clients/provider.py35 # Check if job is doneSTRING
LOWdspy/clients/openai.py141 # Check if there is an active jobCOMMENT
LOWdspy/signatures/signature.py718 # Check if it's a built-in known type or in the provided namesCOMMENT
LOWdspy/signatures/signature.py724 # Check if it matches any known built-in type by nameCOMMENT
LOWdspy/primitives/module.py339 # Check if forward is called through __call__ or directlyCOMMENT
LOWdspy/adapters/utils.py133 # Check if the identifier is a valid enum member value *before* checking if it's a valid enumCOMMENT
LOWdspy/adapters/base.py558 # Check if all fields are present and not NoneCOMMENT
LOWdspy/adapters/base.py561 # Check if demo has at least one input and one output fieldCOMMENT
LOWdspy/adapters/types/citation.py193 # Check if the chunk has citation data in provider_specific_fieldsCOMMENT
LOWdspy/adapters/types/citation.py215 # Check if the response contains citations in the expected formatCOMMENT
LOWdspy/adapters/types/reasoning.py159 # Check if this is a valid string method/attributeCOMMENT
LOWdspy/adapters/types/tool.py101 # Check if the type (or its origin) is a subclass of Pydantic's BaseModelCOMMENT
LOWdspy/teleprompt/bettertogether.py579 # Check if this is the best score so farCOMMENT
LOWtests/docs/test_mkdocs_links.py9 # Read file and extract nav sectionCOMMENT
LOWtests/docs/test_mkdocs_links.py28 # Check if files existCOMMENT
LOWtests/reliability/generate/utils.py278 # Check if the directory contains a program.py and an inputs directoryCOMMENT
LOWtests/reliability/generate/utils.py684 # Read the file contentsSTRING
LOWtests/teleprompt/test_copro_optimizer.py148 # Check if the results_best and results_latest contain valid statisticsCOMMENT
Magic Placeholder Names5 hits · 25 pts
SeverityFileLineSnippetContext
HIGHdocs/docs/tutorials/async/index.md60os.environ["OPENAI_API_KEY"] = "your_api_key"CODE
HIGHdocs/docs/tutorials/async/index.md85os.environ["OPENAI_API_KEY"] = "your_api_key"CODE
HIGHdocs/docs/tutorials/async/index.md142os.environ["OPENAI_API_KEY"] = "your_api_key"CODE
HIGHdocs/docs/tutorials/streaming/index.md23os.environ["OPENAI_API_KEY"] = "your_api_key"CODE
HIGHdocs/docs/tutorials/streaming/index.md471os.environ["OPENAI_API_KEY"] = "your_api_key"CODE
Fake / Example Data19 hits · 21 pts
SeverityFileLineSnippetContext
LOWdspy/adapters/baml_adapter.py208 # PatientDetails(name='John Doe', age=45, address=PatientAddress(street='123 Main St', city='Anytown', country='US')STRING
LOWdspy/adapters/baml_adapter.py208 # PatientDetails(name='John Doe', age=45, address=PatientAddress(street='123 Main St', city='Anytown', country='US')STRING
LOWtests/datasets/test_dataset.py9dummy_data = """content,question,answerCODE
LOWtests/datasets/test_dataset.py34 tmp_file.write(dummy_data)STRING
LOWtests/adapters/test_baml_adapter.py258 name="John Doe", age=45, address=PatientAddress(street="123 Main St", city="Anytown", country="US")CODE
LOWtests/adapters/test_baml_adapter.py258 name="John Doe", age=45, address=PatientAddress(street="123 Main St", city="Anytown", country="US")CODE
LOWtests/adapters/test_baml_adapter.py265 assert '"name": "John Doe"' in user_messageCODE
LOWtests/adapters/test_baml_adapter.py267 assert '"street": "123 Main St"' in user_messageCODE
LOWtests/adapters/test_baml_adapter.py281 patient = PatientDetails(name="Jane Doe", age=30)CODE
LOWtests/adapters/test_baml_adapter.py287 assert '"name": "Jane Doe"' in user_messageCODE
LOWtests/adapters/test_baml_adapter.py525 choices=[Choices(message=Message(content='{"patient": {"name": "John Doe", "age": 28}}'))],CODE
LOWtests/adapters/test_baml_adapter.py534 assert result[0]["patient"].name == "John Doe"CODE
LOWtests/adapters/test_baml_adapter.py623 user_profile = UserProfile(name="John Doe", email="john@example.com", age=30)CODE
LOWtests/adapters/test_baml_adapter.py635 assert '"name": "John Doe"' in user_messageCODE
LOWtests/adapters/test_tool.py344 assert result["primary_address"]["street"] == "123 Main St"CODE
LOWtests/adapters/test_tool.py333 Address(street="123 Main St", city="Test City", zip_code="12345", is_primary=True),CODE
LOWdocs/docs/learn/programming/adapters.md194 "scientists_involved": ["John Doe", "Jane Smith"],CODE
LOWdocs/docs/learn/evaluation/data.md59Values can be accessed using the `.`(dot) operator. You can access the value of key `name` in defined object `Example(naCODE
LOWdocs/docs/deep-dive/data-handling/examples.md60Values can be accessed using the `.`(dot) operator. You can access the value of key `name` in defined object `Example(naCODE
AI Structural Patterns20 hits · 19 pts
SeverityFileLineSnippetContext
LOWdspy/propose/grounded_proposer.py250CODE
LOWdspy/clients/lm.py62CODE
LOWdspy/retrievers/databricks_rm.py84CODE
LOWdspy/utils/exceptions.py24CODE
LOWdspy/primitives/python_interpreter.py147CODE
LOWdspy/evaluate/evaluate.py71CODE
LOWdspy/evaluate/evaluate.py117CODE
LOWdspy/predict/parallel.py10CODE
LOWdspy/teleprompt/bootstrap_trace.py30CODE
LOWdspy/teleprompt/bettertogether.py193CODE
LOWdspy/teleprompt/random_search.py28CODE
LOWdspy/teleprompt/grpo.py27CODE
LOWdspy/teleprompt/utils.py324CODE
LOWdspy/teleprompt/simba.py29CODE
LOWdspy/teleprompt/mipro_optimizer_v2.py61CODE
LOWdspy/teleprompt/mipro_optimizer_v2.py109CODE
LOWdspy/teleprompt/gepa/gepa.py336CODE
LOWdspy/teleprompt/gepa/gepa_utils.py78CODE
LOWdspy/dsp/utils/utils.py45CODE
LOWtests/predict/test_parallel.py156CODE
Over-Commented Block19 hits · 18 pts
SeverityFileLineSnippetContext
LOWdspy/predict/retry.py1# import copyCOMMENT
LOWdspy/predict/retry.py21# prefix="Previous " + actual_prefix,COMMENT
LOWdspy/predict/retry.py41# # Convert the dict past_outputs={"answer": ...} to kwargsCOMMENT
LOWdspy/predict/retry.py61# pred = self.forward(**kwargs)COMMENT
LOWdspy/teleprompt/grpo.py261COMMENT
LOWdspy/teleprompt/grpo.py521 logger.warning(f"GRPOGroup has no diversity. This could be due to low temperature, or low numberCOMMENT
LOWdspy/teleprompt/bootstrap_finetune.py221# ) -> dict[str, Any]:COMMENT
LOWtests/predict/test_retry.py1# import functoolsCOMMENT
LOWtests/predict/test_retry.py21# result = retry_module.forward(COMMENT
LOWtests/predict/test_retry.py41# print(f"SimpleModule got {result.answer=}")COMMENT
LOWtests/predict/test_retry.py61# # class AnswerQuestion(dspy.Signature):COMMENT
LOWtests/predict/test_retry.py81# # return resultCOMMENT
LOWtests/predict/test_predict.py241COMMENT
LOWtests/predict/test_predict.py261# content="¿Qué tal?",COMMENT
LOWtests/reliability/reliability_conf.yaml1adapter: chatCOMMENT
LOWtests/reliability/reliability_conf.yaml21 - model_name: "gpt-4-turbo"COMMENT
LOWtests/reliability/reliability_conf.yaml41 - model_name: "claude-3.5-haiku"COMMENT
LOWtests/reliability/reliability_conf.yaml61 - model_name: "llama-3.1-70b-instruct"COMMENT
LOWdocs/docs/stylesheets/home.css601 border-bottom-color: var(--hp-accent);COMMENT
Cross-File Repetition3 hits · 15 pts
SeverityFileLineSnippetContext
HIGHtests/adapters/test_json_adapter.py0answer the question with multiple answers and scoresSTRING
HIGHtests/adapters/test_chat_adapter.py0answer the question with multiple answers and scoresSTRING
HIGHtests/adapters/test_xml_adapter.py0answer the question with multiple answers and scoresSTRING
AI Slop Vocabulary8 hits · 14 pts
SeverityFileLineSnippetContext
MEDIUMdspy/propose/dataset_summary_generator.py22 """I will also provide you with a few observations I have already made. Please add your own observations or if you STRING
LOWdspy/adapters/utils.py66 # (e.g. the value is a JSON string), just use the string representation of the valueCOMMENT
LOWdspy/evaluate/evaluate.py38 # available, this method will simply return the input string.COMMENT
MEDIUMdspy/teleprompt/gepa/instruction_proposal.py308 # instead of just the current instruction, for more holistic instruction proposals.COMMENT
MEDIUMdspy/dsp/utils/settings.py153 # We check its existence and type to be more robust.COMMENT
LOWtests/predict/test_rlm.py469 # Unclosed fence (just return the body)COMMENT
MEDIUMtests/predict/test_rlm.py453 """Tests for robust fenced-code extraction."""STRING
MEDIUMtests/teleprompt/test_gepa_instruction_proposer.py158 # Use a robust dummy LM with enough responses for optimization stepsCOMMENT
Overly Generic Function Names9 hits · 13 pts
SeverityFileLineSnippetContext
LOWtests/clients/test_cache.py246 def test_function(prompt, model):CODE
LOWtests/clients/test_cache.py303 async def test_function(prompt, model):CODE
LOWtests/clients/test_cache.py330 def test_function(**kwargs):CODE
LOWtests/utils/test_annotation.py6 def test_function():CODE
LOWtests/utils/test_annotation.py17 def test_function():CODE
LOWtests/utils/test_annotation.py55 def test_function():CODE
LOWtests/utils/test_annotation.py64 def test_function():CODE
LOWtests/utils/test_annotation.py72 def test_function():CODE
LOWtests/utils/test_annotation.py84 def test_function():CODE
Verbosity Indicators6 hits · 12 pts
SeverityFileLineSnippetContext
LOWdspy/signatures/signature.py830 # Step 1: Convert camelCase to snake_caseCOMMENT
LOWdspy/signatures/signature.py838 # Step 2: Handle numbers by adding underscores around themCOMMENT
LOWdspy/signatures/signature.py852 # Step 3: Convert to Title Case while preserving acronymsCOMMENT
LOWdspy/teleprompt/mipro_optimizer_v2.py230 # Step 1: Bootstrap few-shot examplesCOMMENT
LOWdspy/teleprompt/mipro_optimizer_v2.py261 # Step 3: Find optimal prompt parametersCOMMENT
LOWdspy/teleprompt/mipro_optimizer_v2.py243 # Step 2: Propose instruction candidatesCOMMENT
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippetContext
CRITICALdocs/docs/diving-deeper/adapters.md147**`dspy.adapters.types.tool.ToolCalls.from_dict_list(...)`**CODE
Synthetic Comment Markers1 hit · 5 pts
SeverityFileLineSnippetContext
HIGHdocs/docs/community/built-with-dspy.md22| **[MedVAL](https://arxiv.org/abs/2507.03152)** | Expert-level validation of AI-generated medical text with scalable laCODE
TODO Padding2 hits · 3 pts
SeverityFileLineSnippetContext
LOWdspy/adapters/json_adapter.py227 # TODO: implement format_finetune_data method in JSONAdapterCOMMENT
LOW.github/workflows/build_and_release.yml81 # TODO: Add tests using dspy-ai-testCOMMENT
Dead Code1 hit · 2 pts
SeverityFileLineSnippetContext
MEDIUMtests/clients/test_lm.py1778CODE