Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme committed Jan 29, 2025
1 parent e57149f commit de439e9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions libs/experimental/langchain_experimental/cpal/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import annotations

import json
from typing import Any, ClassVar, Dict, List, Optional, Type
from typing import Any, ClassVar, Dict, List, Optional, Type, cast

import pydantic
from langchain.base_language import BaseLanguageModel
Expand Down Expand Up @@ -165,7 +165,8 @@ class CPALChain(_BaseStoryElementChain):
causal_chain: Optional[CausalChain] = None
intervention_chain: Optional[InterventionChain] = None
query_chain: Optional[QueryChain] = None
_story: StoryModel = pydantic.PrivateAttr(default=None) # TODO: change name ?
# TODO: change name of _story?
_story: Optional[StoryModel] = pydantic.PrivateAttr(default=None)

@classmethod
def from_univariate_prompt(
Expand Down Expand Up @@ -300,4 +301,4 @@ def draw(self, **kwargs: Any) -> None:
>>> cpal_chain.draw(path="graph.svg")
>>> SVG('graph.svg')
"""
self._story._networkx_wrapper.draw_graphviz(**kwargs)
cast(StoryModel, self._story)._networkx_wrapper.draw_graphviz(**kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def optional_enum_field(
enum=parsed_enum_values, # type: ignore[call-arg]
description=f"{description}. Available options are {parsed_enum_values}",
**field_kwargs,
)
) # type: ignore[call-overload]
elif enum_values:
return Field(
...,
Expand Down
4 changes: 2 additions & 2 deletions libs/experimental/langchain_experimental/tools/python/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class PythonAstREPLTool(BaseTool):
"When using this tool, sometimes output is abbreviated - "
"make sure it does not look abbreviated before using it in your answer."
)
globals: Optional[Dict] = Field(default_factory=dict)
locals: Optional[Dict] = Field(default_factory=dict)
globals: Optional[Dict] = Field(default_factory=dict) # type: ignore[arg-type]
locals: Optional[Dict] = Field(default_factory=dict) # type: ignore[arg-type]
sanitize_input: bool = True
args_schema: Type[BaseModel] = PythonInputs

Expand Down
4 changes: 2 additions & 2 deletions libs/experimental/langchain_experimental/utilities/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def warn_once() -> None:
class PythonREPL(BaseModel):
"""Simulates a standalone Python REPL."""

globals: Optional[Dict] = Field(default_factory=dict, alias="_globals")
locals: Optional[Dict] = Field(default_factory=dict, alias="_locals")
globals: Optional[Dict] = Field(default_factory=dict, alias="_globals") # type: ignore[arg-type]
locals: Optional[Dict] = Field(default_factory=dict, alias="_locals") # type: ignore[arg-type]

@staticmethod
def sanitize_input(query: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_video_captioning_hard() -> None:
chain = VideoCaptioningChain( # type: ignore[call-arg]
llm=ChatOpenAI(
model="gpt-4",
max_tokens=4000,
max_completion_tokens=4000,
)
)
srt_content = chain.run(video_file_path=URL)
Expand Down

0 comments on commit de439e9

Please sign in to comment.