mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: added generic types to ChatOptions and ChatResponse/AgentResponse for Response Format (#3305)
* added generic types to ChatOptions and ChatResponse/AgentResponse for response format * fix typevar import * fix for older python versions * fix missing import * fixed imports * fixed mypy * mypy fix
This commit is contained in:
committed by
GitHub
Unverified
parent
1f8463f9bb
commit
1226828ec2
@@ -1,8 +1,9 @@
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
import sys
|
||||
from collections.abc import Callable, Mapping
|
||||
from pathlib import Path
|
||||
from typing import Any, Literal, TypedDict, cast
|
||||
from typing import Any, Literal, cast
|
||||
|
||||
import yaml
|
||||
from agent_framework import (
|
||||
@@ -42,6 +43,11 @@ from ._models import (
|
||||
agent_schema_dispatch,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import TypedDict # type: ignore # pragma: no cover
|
||||
else:
|
||||
from typing_extensions import TypedDict # type: ignore # pragma: no cover
|
||||
|
||||
|
||||
class ProviderTypeMapping(TypedDict, total=True):
|
||||
package: str
|
||||
|
||||
+8
-1
@@ -24,10 +24,11 @@ See: dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/PowerFx/
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sys
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import dataclass
|
||||
from decimal import Decimal as _Decimal
|
||||
from typing import Any, Literal, TypedDict, cast
|
||||
from typing import Any, Literal, cast
|
||||
|
||||
from agent_framework._workflows import (
|
||||
Executor,
|
||||
@@ -36,6 +37,12 @@ from agent_framework._workflows import (
|
||||
)
|
||||
from powerfx import Engine
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import TypedDict # type: ignore # pragma: no cover
|
||||
else:
|
||||
from typing_extensions import TypedDict # type: ignore # pragma: no cover
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user