Skip to content

Commit d27c336

Browse files
committed
Add type_to_response_format_param()
1 parent f7e2c01 commit d27c336

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

coagent/agents/util.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
import asyncio
22
import functools
3-
from typing import AsyncIterator
3+
from typing import AsyncIterator, Type
44

55
from coagent.core import logger
6+
from pydantic import BaseModel
67

78
from .messages import ChatMessage
89
from .model_client import default_model_client, ModelClient
910

1011

12+
def type_to_response_format_param(
13+
response_format: Type[BaseModel] | dict | None,
14+
) -> dict | None:
15+
import litellm.utils
16+
17+
return litellm.utils.type_to_response_format_param(response_format)
18+
19+
1120
async def chat(
1221
messages: list[ChatMessage], client: ModelClient = default_model_client
1322
) -> ChatMessage:

0 commit comments

Comments
 (0)