DSPy: The framework for programming—not prompting—language models
Python
ruff
Isaac Miller572a27dbc72e
diff --git a/dspy/clients/anyscale.py b/dspy/clients/anyscale.pyindex a10a0453b..c097d5f1f 100644--- a/dspy/clients/anyscale.py+++ b/dspy/clients/anyscale.py@@ -1,10 +1,7 @@-from typing import Any, Dict, List, Optional, Union+from typing import Any, Dict, List, Optionalimport jsonimport yamlimport os-from concurrent.futures import ThreadPoolExecutor-from collections import defaultdict-import functoolsfrom dspy.utils.logging import loggerfrom dspy.clients.finetune import (@@ -13,7 +10,6 @@ from dspy.clients.finetune import (save_data,)from dspy.clients.openai import openai_data_validation, check_message_lengths-import asynciotry:# Importing the AnyScale library for users in the AnyScale workspace, wherediff --git a/dspy/clients/lm.py b/dspy/clients/lm.pyindex 76326bc08..e5b6d84f8 100644--- a/dspy/clients/lm.py+++ b/dspy/clients/lm.py@@ -253,7 +253,6 @@ from dspy.clients.openai import ()from dspy.clients.anyscale import (FinetuneJobAnyScale,- is_anyscale_model,finetune_anyscale,)@@ -279,7 +278,7 @@ def _get_supported_finetune_provider(model: str) -> Union[str, ValueError]:if is_anyscale_model(model):return _PROVIDER_ANYSCALE- return ValueError(f"Unable {model}")+ return ValueError(f"DSPy does not have fine-tuning support for {model}")def get_provider_finetune_job_class(provider: str) -> Type[FinetuneJob]:diff --git a/dspy/clients/openai.py b/dspy/clients/openai.pyindex dae20b9d0..aedeb0232 100644--- a/dspy/clients/openai.py+++ b/dspy/clients/openai.py@@ -223,7 +223,7 @@ def _does_job_exist(job_id: str) -> bool:# TODO: Error handling is vagueopenai.fine_tuning.jobs.retrieve(job_id)return True- except Exception as e:+ except Exception:return False@@ -232,7 +232,7 @@ def _does_file_exist(file_id: str) -> bool:# TODO: Error handling is vagueopenai.files.retrieve(file_id)return True- except Exception as e:+ except Exception:return Falsediff --git a/dspy/predict/predict.py b/dspy/predict/predict.pyindex 259f3a3e9..dbee7f698 100644--- a/dspy/predict/predict.py+++ b/dspy/predict/predict.py@@ -10,7 +10,6 @@ import dspfrom dspy.predict.parameter import Parameterfrom dspy.primitives.program import Modulefrom dspy.primitives.prediction import Prediction-from dspy.primitives.program import Modulefrom dspy.signatures.signature import ensure_signature, signature_to_templatediff --git a/dspy/teleprompt/finetune_teleprompter.py b/dspy/teleprompt/finetune_teleprompter.pyindex 4bddd815c..caecabf4c 100644--- a/dspy/teleprompt/finetune_teleprompter.py+++ b/dspy/teleprompt/finetune_teleprompter.py@@ -7,7 +7,6 @@ from dspy.primitives.example import Examplefrom dspy.primitives.program import Programfrom dspy.primitives.prediction import Prediction-import concurrent.futures#-------------------------------------------------------------------------------# Templates for the user-facing strings used by this module