fix(core): support NotRequired metadata on Python 3.10

This commit is contained in:
John Kennedy
2026-07-11 14:02:09 -07:00
parent 4f43959193
commit 229c1eb399
2 changed files with 11 additions and 1 deletions

7
.gitignore vendored
View File

@@ -113,6 +113,7 @@ celerybeat.pid
# Environments
.env
.env.*
.envrc
.venv*
venv*
@@ -120,6 +121,12 @@ env/
ENV/
env.bak/
# Credentials and certificates
*.pem
*.key
*.crt
credentials.json
# Spyder project settings
.spyderproject
.spyproject

View File

@@ -3,6 +3,7 @@
from typing import get_type_hints
import pytest
from typing_extensions import NotRequired
from langchain_core.utils.gateway import (
LANGSMITH_GATEWAY_PROVIDERS,
@@ -128,4 +129,6 @@ def test_resolve_langsmith_gateway_url_preserves_query_and_fragment(
def test_gateway_provider_config_runtime_type_metadata() -> None:
"""The public provider configuration retains optional-key metadata at runtime."""
assert GatewayProviderConfig.__optional_keys__ == {"notes"}
assert get_type_hints(GatewayProviderConfig)["notes"] is str
assert get_type_hints(GatewayProviderConfig, include_extras=True)[
"notes"
] == NotRequired[str]