Module livekit.plugins.openai.tools
Classes
class CodeInterpreter (container: str | dict[str, typing.Any] | None)-
Expand source code
@dataclass(slots=True) class CodeInterpreter(OpenAITool): """Enable the code interpreter tool to write and execute Python code in a sandboxed environment""" container: Optional[str | dict[str, Any]] def to_dict(self) -> dict[str, Any]: result = {"type": "code_interpreter", "container": self.container} return resultEnable the code interpreter tool to write and execute Python code in a sandboxed environment
Ancestors
- OpenAITool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Instance variables
var container : str | dict[str, typing.Any] | None-
Expand source code
@dataclass(slots=True) class CodeInterpreter(OpenAITool): """Enable the code interpreter tool to write and execute Python code in a sandboxed environment""" container: Optional[str | dict[str, Any]] def to_dict(self) -> dict[str, Any]: result = {"type": "code_interpreter", "container": self.container} return result
Methods
def to_dict(self) ‑> dict[str, typing.Any]-
Expand source code
def to_dict(self) -> dict[str, Any]: result = {"type": "code_interpreter", "container": self.container} return result
class FileSearch (vector_store_ids: list[str] = <factory>,
filters: openai.types.shared.comparison_filter.ComparisonFilter | openai.types.shared.compound_filter.CompoundFilter | None = None,
max_num_results: int | None = None,
ranking_options: openai.types.responses.file_search_tool.RankingOptions | None = None)-
Expand source code
@dataclass(slots=True) class FileSearch(OpenAITool): """Enable file search tool to search uploaded document collections""" vector_store_ids: list[str] = field(default_factory=list) filters: Optional[responses.file_search_tool.Filters] = None max_num_results: Optional[int] = None ranking_options: Optional[responses.file_search_tool.RankingOptions] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "file_search", "vector_store_ids": self.vector_store_ids, } if self.filters is not None: result["filters"] = self.filters if self.max_num_results is not None: result["max_num_results"] = self.max_num_results if self.ranking_options is not None: result["ranking_options"] = self.ranking_options return resultEnable file search tool to search uploaded document collections
Ancestors
- OpenAITool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Instance variables
var filters : openai.types.shared.comparison_filter.ComparisonFilter | openai.types.shared.compound_filter.CompoundFilter | None-
Expand source code
@dataclass(slots=True) class FileSearch(OpenAITool): """Enable file search tool to search uploaded document collections""" vector_store_ids: list[str] = field(default_factory=list) filters: Optional[responses.file_search_tool.Filters] = None max_num_results: Optional[int] = None ranking_options: Optional[responses.file_search_tool.RankingOptions] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "file_search", "vector_store_ids": self.vector_store_ids, } if self.filters is not None: result["filters"] = self.filters if self.max_num_results is not None: result["max_num_results"] = self.max_num_results if self.ranking_options is not None: result["ranking_options"] = self.ranking_options return result var max_num_results : int | None-
Expand source code
@dataclass(slots=True) class FileSearch(OpenAITool): """Enable file search tool to search uploaded document collections""" vector_store_ids: list[str] = field(default_factory=list) filters: Optional[responses.file_search_tool.Filters] = None max_num_results: Optional[int] = None ranking_options: Optional[responses.file_search_tool.RankingOptions] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "file_search", "vector_store_ids": self.vector_store_ids, } if self.filters is not None: result["filters"] = self.filters if self.max_num_results is not None: result["max_num_results"] = self.max_num_results if self.ranking_options is not None: result["ranking_options"] = self.ranking_options return result var ranking_options : openai.types.responses.file_search_tool.RankingOptions | None-
Expand source code
@dataclass(slots=True) class FileSearch(OpenAITool): """Enable file search tool to search uploaded document collections""" vector_store_ids: list[str] = field(default_factory=list) filters: Optional[responses.file_search_tool.Filters] = None max_num_results: Optional[int] = None ranking_options: Optional[responses.file_search_tool.RankingOptions] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "file_search", "vector_store_ids": self.vector_store_ids, } if self.filters is not None: result["filters"] = self.filters if self.max_num_results is not None: result["max_num_results"] = self.max_num_results if self.ranking_options is not None: result["ranking_options"] = self.ranking_options return result var vector_store_ids : list[str]-
Expand source code
@dataclass(slots=True) class FileSearch(OpenAITool): """Enable file search tool to search uploaded document collections""" vector_store_ids: list[str] = field(default_factory=list) filters: Optional[responses.file_search_tool.Filters] = None max_num_results: Optional[int] = None ranking_options: Optional[responses.file_search_tool.RankingOptions] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "file_search", "vector_store_ids": self.vector_store_ids, } if self.filters is not None: result["filters"] = self.filters if self.max_num_results is not None: result["max_num_results"] = self.max_num_results if self.ranking_options is not None: result["ranking_options"] = self.ranking_options return result
Methods
def to_dict(self) ‑> dict[str, typing.Any]-
Expand source code
def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "file_search", "vector_store_ids": self.vector_store_ids, } if self.filters is not None: result["filters"] = self.filters if self.max_num_results is not None: result["max_num_results"] = self.max_num_results if self.ranking_options is not None: result["ranking_options"] = self.ranking_options return result
class OpenAITool-
Expand source code
class OpenAITool(ProviderTool, ABC): @abstractmethod def to_dict(self) -> dict[str, Any]: ...Tool that provided by the LLM provider.
Ancestors
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Subclasses
Methods
def to_dict(self) ‑> dict[str, typing.Any]-
Expand source code
@abstractmethod def to_dict(self) -> dict[str, Any]: ...
class WebSearch (filters: openai.types.responses.web_search_tool.Filters | None = None,
search_context_size: Literal['low', 'medium', 'high'] | None = 'medium',
user_location: openai.types.responses.web_search_tool.UserLocation | None = None)-
Expand source code
@dataclass(slots=True) class WebSearch(OpenAITool): """Enable web search tool to access up-to-date information from the internet""" filters: Optional[responses.web_search_tool.Filters] = None search_context_size: Optional[Literal["low", "medium", "high"]] = "medium" user_location: Optional[responses.web_search_tool.UserLocation] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "web_search", "search_context_size": self.search_context_size, } if self.user_location is not None: result["user_location"] = self.user_location if self.filters is not None: result["filters"] = self.filters return resultEnable web search tool to access up-to-date information from the internet
Ancestors
- OpenAITool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Instance variables
var filters : openai.types.responses.web_search_tool.Filters | None-
Expand source code
@dataclass(slots=True) class WebSearch(OpenAITool): """Enable web search tool to access up-to-date information from the internet""" filters: Optional[responses.web_search_tool.Filters] = None search_context_size: Optional[Literal["low", "medium", "high"]] = "medium" user_location: Optional[responses.web_search_tool.UserLocation] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "web_search", "search_context_size": self.search_context_size, } if self.user_location is not None: result["user_location"] = self.user_location if self.filters is not None: result["filters"] = self.filters return result var search_context_size : Literal['low', 'medium', 'high'] | None-
Expand source code
@dataclass(slots=True) class WebSearch(OpenAITool): """Enable web search tool to access up-to-date information from the internet""" filters: Optional[responses.web_search_tool.Filters] = None search_context_size: Optional[Literal["low", "medium", "high"]] = "medium" user_location: Optional[responses.web_search_tool.UserLocation] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "web_search", "search_context_size": self.search_context_size, } if self.user_location is not None: result["user_location"] = self.user_location if self.filters is not None: result["filters"] = self.filters return result var user_location : openai.types.responses.web_search_tool.UserLocation | None-
Expand source code
@dataclass(slots=True) class WebSearch(OpenAITool): """Enable web search tool to access up-to-date information from the internet""" filters: Optional[responses.web_search_tool.Filters] = None search_context_size: Optional[Literal["low", "medium", "high"]] = "medium" user_location: Optional[responses.web_search_tool.UserLocation] = None def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "web_search", "search_context_size": self.search_context_size, } if self.user_location is not None: result["user_location"] = self.user_location if self.filters is not None: result["filters"] = self.filters return result
Methods
def to_dict(self) ‑> dict[str, typing.Any]-
Expand source code
def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = { "type": "web_search", "search_context_size": self.search_context_size, } if self.user_location is not None: result["user_location"] = self.user_location if self.filters is not None: result["filters"] = self.filters return result