Skip to content

Commit 199267e

Browse files
committed
Fix Ruff issues
1 parent 8b34940 commit 199267e

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

dspy_code/commands/interactive_command.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ def _show_lm_configuration_hint(self) -> None:
10721072
" configure DSPy like:[/dim]"
10731073
)
10741074
console.print(
1075-
f"[cyan]lm = dspy.LM(model=\"ollama/{model_name}\", api_base=\"http://localhost:11434\")[/cyan]"
1075+
f'[cyan]lm = dspy.LM(model="ollama/{model_name}", api_base="http://localhost:11434")[/cyan]'
10761076
)
10771077
console.print("[cyan]dspy.configure(lm=lm)[/cyan]\n")
10781078
elif model_type == "openai":
@@ -1081,23 +1081,23 @@ def _show_lm_configuration_hint(self) -> None:
10811081
" configure DSPy like:[/dim]"
10821082
)
10831083
console.print(
1084-
f"[cyan]lm = dspy.LM(model=\"openai/{model_name}\")[/cyan]\n[cyan]dspy.configure(lm=lm)[/cyan]\n"
1084+
f'[cyan]lm = dspy.LM(model="openai/{model_name}")[/cyan]\n[cyan]dspy.configure(lm=lm)[/cyan]\n'
10851085
)
10861086
elif model_type == "anthropic":
10871087
console.print(
10881088
"\n[dim]💡 To run this program with your connected Anthropic model,"
10891089
" configure DSPy like:[/dim]"
10901090
)
10911091
console.print(
1092-
f"[cyan]lm = dspy.LM(model=\"anthropic/{model_name}\")[/cyan]\n[cyan]dspy.configure(lm=lm)[/cyan]\n"
1092+
f'[cyan]lm = dspy.LM(model="anthropic/{model_name}")[/cyan]\n[cyan]dspy.configure(lm=lm)[/cyan]\n'
10931093
)
10941094
elif model_type == "gemini":
10951095
console.print(
10961096
"\n[dim]💡 To run this program with your connected Gemini model,"
10971097
" configure DSPy like:[/dim]"
10981098
)
10991099
console.print(
1100-
f"[cyan]lm = dspy.LM(model=\"gemini/{model_name}\")[/cyan]\n[cyan]dspy.configure(lm=lm)[/cyan]\n"
1100+
f'[cyan]lm = dspy.LM(model="gemini/{model_name}")[/cyan]\n[cyan]dspy.configure(lm=lm)[/cyan]\n'
11011101
)
11021102

11031103
def _extract_data_generation_params(self, user_input: str) -> tuple[str, int]:

dspy_code/commands/nl_command_router.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,7 @@ def route(
513513

514514
# If the user mentions a specific slash command in natural language,
515515
# allow the LLM router to decide whether to dispatch it.
516-
logger.debug(
517-
f"Using LLM reasoning for explicit slash command reference: '{user_input}'"
518-
)
516+
logger.debug(f"Using LLM reasoning for explicit slash command reference: '{user_input}'")
519517
return self._route_with_llm(user_input, context, pattern_matches=None)
520518

521519
def _route_with_llm(

dspy_code/commands/slash_commands.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ def cmd_model(self, args: list):
238238
console.print()
239239
console.print("[bold cyan]🧠 Model Selector[/bold cyan]")
240240
console.print(" [1] Local models via [bold]Ollama[/bold]")
241-
console.print(" [2] Cloud provider ([bold]OpenAI[/bold], [bold]Anthropic[/bold], [bold]Gemini[/bold])")
241+
console.print(
242+
" [2] Cloud provider ([bold]OpenAI[/bold], [bold]Anthropic[/bold], [bold]Gemini[/bold])"
243+
)
242244
console.print(" [q] Cancel")
243245
choice = console.input("[cyan]Select model source [1/2/q]: [/cyan]").strip().lower()
244246

@@ -282,9 +284,13 @@ def _select_ollama_model(self) -> None:
282284
console.print(f" [cyan]{idx}.[/cyan] {model_name}")
283285

284286
console.print()
285-
selection = console.input(
286-
"[cyan]Enter the number of the model to connect (or q to cancel): [/cyan]"
287-
).strip().lower()
287+
selection = (
288+
console.input(
289+
"[cyan]Enter the number of the model to connect (or q to cancel): [/cyan]"
290+
)
291+
.strip()
292+
.lower()
293+
)
288294

289295
if selection in {"q", "quit", "exit"}:
290296
show_info_message("Model selection cancelled.")

dspy_code/models/llm_connector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def _generate_openai(
265265
except ImportError as exc:
266266
raise ModelError(
267267
"OpenAI SDK not installed!\n"
268-
"Install it with: pip install \"openai>=2.8.1\" # or newer 2.x version\n"
268+
'Install it with: pip install "openai>=2.8.1" # or newer 2.x version\n'
269269
"DSPy Code doesn't include provider SDKs by default - install only what you need."
270270
) from exc
271271

@@ -357,7 +357,7 @@ def _generate_gemini(
357357
except ImportError as exc:
358358
raise ModelError(
359359
"Google Gemini SDK not installed!\n"
360-
"Install the official SDK with: pip install \"google-genai>=1.52.0\" \n"
360+
'Install the official SDK with: pip install "google-genai>=1.52.0" \n'
361361
"DSPy Code doesn't include provider SDKs by default - install only what you need."
362362
) from exc
363363

dspy_code/models/model_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def _create_gemini_client(self, config: dict[str, Any]):
211211

212212
except ImportError:
213213
raise ModelError(
214-
"Google Gen AI SDK not installed. Run: pip install \"google-genai>=1.52.0\""
214+
'Google Gen AI SDK not installed. Run: pip install "google-genai>=1.52.0"'
215215
)
216216
except Exception as e:
217217
raise ModelError(f"Failed to create Gemini client: {e}")

0 commit comments

Comments
 (0)