style: repo linting pass (#33089)

enable docstring-code-format
This commit is contained in:
Mason Daugherty
2025-09-24 15:25:55 -04:00
committed by GitHub
parent 083bb3cdd7
commit b92b394804
33 changed files with 687 additions and 283 deletions

View File

@@ -110,16 +110,19 @@ class ChatDeepSeek(BaseChatOpenAI):
from pydantic import BaseModel, Field
class GetWeather(BaseModel):
'''Get the current weather in a given location'''
location: str = Field(..., description="The city and state, e.g. San Francisco, CA")
class GetPopulation(BaseModel):
'''Get the current population in a given location'''
location: str = Field(..., description="The city and state, e.g. San Francisco, CA")
llm_with_tools = llm.bind_tools([GetWeather, GetPopulation])
ai_msg = llm_with_tools.invoke("Which city is hotter today and which is bigger: LA or NY?")
ai_msg.tool_calls
@@ -133,6 +136,7 @@ class ChatDeepSeek(BaseChatOpenAI):
from pydantic import BaseModel, Field
class Joke(BaseModel):
'''Joke to tell user.'''
@@ -140,6 +144,7 @@ class ChatDeepSeek(BaseChatOpenAI):
punchline: str = Field(description="The punchline to the joke")
rating: Optional[int] = Field(description="How funny the joke is, from 1 to 10")
structured_llm = llm.with_structured_output(Joke)
structured_llm.invoke("Tell me a joke about cats")
@@ -153,7 +158,7 @@ class ChatDeepSeek(BaseChatOpenAI):
.. code-block:: python
{'input_tokens': 28, 'output_tokens': 5, 'total_tokens': 33}
{"input_tokens": 28, "output_tokens": 5, "total_tokens": 33}
Response metadata
.. code-block:: python