mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-22 19:09:57 +00:00
Install and use ruff format
instead of black for code formatting. (#12585)
Best to review one commit at a time, since two of the commits are 100% autogenerated changes from running `ruff format`: - Install and use `ruff format` instead of black for code formatting. - Output of `ruff format .` in the `langchain` package. - Use `ruff format` in experimental package. - Format changes in experimental package by `ruff format`. - Manual formatting fixes to make `ruff .` pass.
This commit is contained in:
@@ -16,7 +16,7 @@ def create_openai_data_generator(
|
||||
llm: ChatOpenAI,
|
||||
prompt: BasePromptTemplate,
|
||||
output_parser: Optional[BaseLLMOutputParser] = None,
|
||||
**kwargs: Any
|
||||
**kwargs: Any,
|
||||
) -> SyntheticDataGenerator:
|
||||
"""
|
||||
Create an instance of SyntheticDataGenerator tailored for OpenAI models.
|
||||
|
@@ -29,7 +29,7 @@ class BaseThoughtGenerationStrategy(LLMChain):
|
||||
self,
|
||||
problem_description: str,
|
||||
thoughts_path: Tuple[str, ...] = (),
|
||||
**kwargs: Any
|
||||
**kwargs: Any,
|
||||
) -> str:
|
||||
"""
|
||||
Generate the next thought given the problem description and the thoughts
|
||||
@@ -52,7 +52,7 @@ class SampleCoTStrategy(BaseThoughtGenerationStrategy):
|
||||
self,
|
||||
problem_description: str,
|
||||
thoughts_path: Tuple[str, ...] = (),
|
||||
**kwargs: Any
|
||||
**kwargs: Any,
|
||||
) -> str:
|
||||
response_text = self.predict_and_parse(
|
||||
problem_description=problem_description, thoughts=thoughts_path, **kwargs
|
||||
@@ -76,14 +76,14 @@ class ProposePromptStrategy(BaseThoughtGenerationStrategy):
|
||||
self,
|
||||
problem_description: str,
|
||||
thoughts_path: Tuple[str, ...] = (),
|
||||
**kwargs: Any
|
||||
**kwargs: Any,
|
||||
) -> str:
|
||||
if thoughts_path not in self.tot_memory or not self.tot_memory[thoughts_path]:
|
||||
new_thoughts = self.predict_and_parse(
|
||||
problem_description=problem_description,
|
||||
thoughts=thoughts_path,
|
||||
n=self.c,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
if not new_thoughts:
|
||||
return ""
|
||||
|
Reference in New Issue
Block a user