openai[patch]: add test for message.name (#29651)

This commit is contained in:
ccurme 2025-02-06 16:49:28 -05:00 committed by GitHub
parent 91cca827c0
commit 29a0c38cc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1202,3 +1202,14 @@ def test_o1_doesnt_stream() -> None:
def test_o1_stream_default_works() -> None:
result = list(ChatOpenAI(model="o1").stream("say 'hi'"))
assert len(result) > 0
def test_multi_party_conversation() -> None:
llm = ChatOpenAI(model="gpt-4o")
messages = [
HumanMessage("Hi, I have black hair.", name="Alice"),
HumanMessage("Hi, I have brown hair.", name="Bob"),
HumanMessage("Who just spoke?", name="Charlie"),
]
response = llm.invoke(messages)
assert "Bob" in response.content