Skip to content

Commit

Permalink
remove warning for method param
Browse files Browse the repository at this point in the history
  • Loading branch information
raspawar committed Nov 12, 2024
1 parent 60c5e6a commit 7083c62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -773,13 +773,6 @@ class Choices(enum.Enum):
For more, see https://python.langchain.com/docs/how_to/structured_output/
""" # noqa: E501

if "method" in kwargs:
warnings.warn(
"The 'method' parameter is unnecessary and is ignored. "
"The appropriate method will be chosen automatically depending "
"on the type of schema provided."
)

if kwargs.get("strict", True) is not True:
warnings.warn(
"Structured output always follows strict validation. "
Expand Down
22 changes: 11 additions & 11 deletions libs/ai-endpoints/tests/unit_tests/test_structured_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class Joke(pydanticV2BaseModel):
rating: Optional[int] = Field(description="How funny the joke is, from 1 to 10")


def test_method() -> None:
with pytest.warns(UserWarning) as record:
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
category=UserWarning,
message=".*not known to support structured output.*",
)
ChatNVIDIA(api_key="BOGUS").with_structured_output(Joke, method="json_mode")
assert len(record) == 1
assert "unnecessary" in str(record[0].message)
# def test_method() -> None:
# with pytest.warns(UserWarning) as record:
# with warnings.catch_warnings():
# warnings.filterwarnings(
# "ignore",
# category=UserWarning,
# message=".*not known to support structured output.*",
# )
# ChatNVIDIA(api_key="BOGUS").with_structured_output(Joke, method="json_mode")

Check failure on line 30 in libs/ai-endpoints/tests/unit_tests/test_structured_output.py

View workflow job for this annotation

GitHub Actions / cd libs/ai-endpoints / make lint #3.8

Ruff (E501)

tests/unit_tests/test_structured_output.py:30:89: E501 Line too long (90 > 88)
# assert len(record) == 1
# assert "unnecessary" in str(record[0].message)


def test_include_raw() -> None:
Expand Down

0 comments on commit 7083c62

Please sign in to comment.