Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions examples/basic/stream_function_call_args.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import asyncio
from typing import Any
from typing import Annotated, Any, Optional

from openai.types.responses import ResponseFunctionCallArgumentsDeltaEvent

from agents import Agent, Runner, function_tool


@function_tool
def write_file(filename: str, content: str) -> str:
def write_file(filename: Annotated[str, "Name of the file"], content: str) -> str:
"""Write content to a file."""
return f"File {filename} written successfully"


@function_tool
def create_config(project_name: str, version: str, dependencies: list[str]) -> str:
"""Create a configuration file for a project."""
def create_config(
project_name: Annotated[str, "Project name"],
version: Annotated[str, "Project version"],
dependencies: Annotated[Optional[list[str]], "Dependencies (list of packages)"],
) -> str:
"""Generate a project configuration file."""
return f"Config for {project_name} v{version} created"


Expand Down