standard-tests[patch]: fix oai usage metadata test (#27122)

This commit is contained in:
Bagatur
2024-10-04 13:00:48 -07:00
committed by GitHub
parent 827bdf4f51
commit bd5b335cb4
5 changed files with 52 additions and 64 deletions

View File

@@ -1,7 +1,7 @@
"""Standard LangChain interface tests"""
from pathlib import Path
from typing import List, Literal, Type, cast
from typing import Dict, List, Literal, Type, cast
from langchain_core.language_models import BaseChatModel
from langchain_core.messages import AIMessage
@@ -36,16 +36,22 @@ class TestAnthropicStandard(ChatModelIntegrationTests):
@property
def supported_usage_metadata_details(
self,
) -> List[
Literal[
"audio_input",
"audio_output",
"reasoning_output",
"cache_read_input",
"cache_creation_input",
]
) -> Dict[
Literal["invoke", "stream"],
List[
Literal[
"audio_input",
"audio_output",
"reasoning_output",
"cache_read_input",
"cache_creation_input",
]
],
]:
return ["cache_read_input", "cache_creation_input"]
return {
"invoke": ["cache_read_input", "cache_creation_input"],
"stream": ["cache_read_input", "cache_creation_input"],
}
def invoke_with_cache_creation_input(self, *, stream: bool = False) -> AIMessage:
llm = ChatAnthropic(