File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
libs/partners/anthropic/tests/integration_tests Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
from __future__ import annotations
4
4
5
- from enum import Enum
6
- from typing import Optional
5
+ from typing import Literal , Optional
7
6
8
7
from langchain_core .prompts import ChatPromptTemplate
9
8
from pydantic import BaseModel , Field
@@ -123,10 +122,6 @@ class Person(BaseModel):
123
122
124
123
125
124
def test_anthropic_complex_structured_output () -> None :
126
- class ToneEnum (str , Enum ):
127
- positive = "positive"
128
- negative = "negative"
129
-
130
125
class Email (BaseModel ):
131
126
"""Relevant information about an email."""
132
127
@@ -150,7 +145,9 @@ class Email(BaseModel):
150
145
...,
151
146
description = "High level description of what the email is about" ,
152
147
)
153
- tone : ToneEnum = Field (..., description = "The tone of the email." )
148
+ tone : Literal ["positive" , "negative" ] = Field (
149
+ ..., description = "The tone of the email."
150
+ )
154
151
155
152
prompt = ChatPromptTemplate .from_messages (
156
153
[
You can’t perform that action at this time.
0 commit comments