Skip to content

Commit 2ef9465

Browse files
authored
fix(anthropic): fix test (#32145)
1 parent 0355da3 commit 2ef9465

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

libs/partners/anthropic/tests/integration_tests/test_experimental.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
from __future__ import annotations
44

5-
from enum import Enum
6-
from typing import Optional
5+
from typing import Literal, Optional
76

87
from langchain_core.prompts import ChatPromptTemplate
98
from pydantic import BaseModel, Field
@@ -123,10 +122,6 @@ class Person(BaseModel):
123122

124123

125124
def test_anthropic_complex_structured_output() -> None:
126-
class ToneEnum(str, Enum):
127-
positive = "positive"
128-
negative = "negative"
129-
130125
class Email(BaseModel):
131126
"""Relevant information about an email."""
132127

@@ -150,7 +145,9 @@ class Email(BaseModel):
150145
...,
151146
description="High level description of what the email is about",
152147
)
153-
tone: ToneEnum = Field(..., description="The tone of the email.")
148+
tone: Literal["positive", "negative"] = Field(
149+
..., description="The tone of the email."
150+
)
154151

155152
prompt = ChatPromptTemplate.from_messages(
156153
[

0 commit comments

Comments
 (0)