standard-tests[patch]: test init from env vars (#25983)

This commit is contained in:
Bagatur
2024-09-03 12:05:39 -07:00
committed by GitHub
parent ac922105ad
commit bc3b02651c
3 changed files with 63 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
"""Standard LangChain interface tests"""
from typing import Type
from typing import Tuple, Type
from langchain_core.language_models import BaseChatModel
from langchain_standard_tests.unit_tests import ChatModelUnitTests
@@ -12,3 +12,21 @@ class TestOpenAIStandard(ChatModelUnitTests):
@property
def chat_model_class(self) -> Type[BaseChatModel]:
return ChatOpenAI
@property
def init_from_env_params(self) -> Tuple[dict, dict, dict]:
return (
{
"OPENAI_API_KEY": "api_key",
"OPENAI_ORGANIZATION": "org_id",
"OPENAI_API_BASE": "api_base",
"OPENAI_PROXY": "https://proxy.com",
},
{},
{
"openai_api_key": "api_key",
"openai_organization": "org_id",
"openai_api_base": "api_base",
"openai_proxy": "https://proxy.com",
},
)