Skip to content

Commit

Permalink
style: format code with Autopep8
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in cdab125 according to the output
from Autopep8.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Dec 19, 2024
1 parent cdab125 commit 815276b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions python/openwebui/pipe_mcts.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def get_chunk_content(self, chunk):
if "content" in delta:
yield delta["content"]
except json.JSONDecodeError:
logger.error(f'ChunkDecodeError: unable to parse "{chunk_str[:100]}"')
logger.error(
f'ChunkDecodeError: unable to parse "{chunk_str[:100]}"')


# =============================================================================
Expand Down Expand Up @@ -277,7 +278,8 @@ async def update_approach(self, answer: str, improvements: str):
return await self.generate_completion(prompt)

async def evaluate_answer(self, answer: str):
prompt = eval_answer_prompt.format(question=self.question, answer=answer)
prompt = eval_answer_prompt.format(
question=self.question, answer=answer)
result = await self.generate_completion(prompt)
try:
score = int(re.search(r"\d+", result).group())
Expand Down Expand Up @@ -397,8 +399,10 @@ class Valves(BaseModel):
USE_OPENAI: bool = Field(
default=True, description="Whether to use OpenAI endpoints"
)
LANGFUSE_SECRET_KEY: str = Field(default="", description="Langfuse secret key")
LANGFUSE_PUBLIC_KEY: str = Field(default="", description="Langfuse public key")
LANGFUSE_SECRET_KEY: str = Field(
default="", description="Langfuse secret key")
LANGFUSE_PUBLIC_KEY: str = Field(
default="", description="Langfuse public key")
LANGFUSE_URL: str = Field(default="", description="Langfuse URL")
EXPLORATION_WEIGHT: float = Field(
default=1.414, description="Exploration weight for MCTS"
Expand Down Expand Up @@ -484,7 +488,8 @@ async def pipe(
if match:
backend, model_name = match.groups()
else:
logger.error("Model ID should be in the format '*.mcts/backend/model_name'")
logger.error(
"Model ID should be in the format '*.mcts/backend/model_name'")
logger.error(f"Invalid model ID: {model_id}")
return ""

Expand All @@ -503,7 +508,8 @@ async def pipe(

# Handle title generation task
if __task__ == TASKS.TITLE_GENERATION:
logger.debug(f"Generating title for question: {question} using {self.model} and {self.backend}")
logger.debug(
f"Generating title for question: {question} using {self.model} and {self.backend}")
content = await self.llm_client.get_completion(
messages, self.model, backend=self.backend
)
Expand Down

0 comments on commit 815276b

Please sign in to comment.