mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-06 21:43:44 +00:00
core, partners: implement standard tracing params for LLMs (#25410)
This commit is contained in:
23
libs/partners/openai/tests/unit_tests/llms/test_azure.py
Normal file
23
libs/partners/openai/tests/unit_tests/llms/test_azure.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from typing import Any
|
||||
|
||||
from langchain_openai import AzureOpenAI
|
||||
|
||||
|
||||
def test_azure_model_param(monkeypatch: Any) -> None:
|
||||
monkeypatch.delenv("OPENAI_API_BASE", raising=False)
|
||||
llm = AzureOpenAI(
|
||||
openai_api_key="secret-api-key", # type: ignore[call-arg]
|
||||
azure_endpoint="endpoint",
|
||||
api_version="version",
|
||||
azure_deployment="gpt-35-turbo-instruct",
|
||||
)
|
||||
|
||||
# Test standard tracing params
|
||||
ls_params = llm._get_ls_params()
|
||||
assert ls_params == {
|
||||
"ls_provider": "azure",
|
||||
"ls_model_type": "llm",
|
||||
"ls_model_name": "gpt-35-turbo-instruct",
|
||||
"ls_temperature": 0.7,
|
||||
"ls_max_tokens": 256,
|
||||
}
|
@@ -14,6 +14,16 @@ def test_openai_model_param() -> None:
|
||||
llm = OpenAI(model_name="foo") # type: ignore[call-arg]
|
||||
assert llm.model_name == "foo"
|
||||
|
||||
# Test standard tracing params
|
||||
ls_params = llm._get_ls_params()
|
||||
assert ls_params == {
|
||||
"ls_provider": "openai",
|
||||
"ls_model_type": "llm",
|
||||
"ls_model_name": "foo",
|
||||
"ls_temperature": 0.7,
|
||||
"ls_max_tokens": 256,
|
||||
}
|
||||
|
||||
|
||||
def test_openai_model_kwargs() -> None:
|
||||
llm = OpenAI(model_kwargs={"foo": "bar"})
|
||||
|
Reference in New Issue
Block a user