|
28 | 28 | AgentIntegrationToolResourceConfig, |
29 | 29 | AgentInternalBatchTransformToolProperties, |
30 | 30 | AgentInternalDeepRagToolProperties, |
| 31 | + AgentInternalGenerateFileToolProperties, |
31 | 32 | AgentInternalHttpRequestToolProperties, |
32 | 33 | AgentInternalToolResourceConfig, |
33 | 34 | AgentInternalToolType, |
@@ -1757,6 +1758,53 @@ def test_agent_with_unknown_resource_type(self): |
1757 | 1758 | assert unknown_resource.name == "Future Resource" |
1758 | 1759 | assert unknown_resource.description == "A resource type that doesn't exist yet" |
1759 | 1760 |
|
| 1761 | + def test_agent_with_generate_file_tool(self): |
| 1762 | + json_data = { |
| 1763 | + "id": "test-generate-file", |
| 1764 | + "name": "Agent with Generate File", |
| 1765 | + "version": "1.0.0", |
| 1766 | + "settings": { |
| 1767 | + "model": "gpt-4o-2024-11-20", |
| 1768 | + "maxTokens": 16384, |
| 1769 | + "temperature": 0, |
| 1770 | + "engine": "basic-v1", |
| 1771 | + }, |
| 1772 | + "inputSchema": {"type": "object", "properties": {}}, |
| 1773 | + "outputSchema": {"type": "object", "properties": {}}, |
| 1774 | + "resources": [ |
| 1775 | + { |
| 1776 | + "$resourceType": "tool", |
| 1777 | + "type": "internal", |
| 1778 | + "referenceKey": None, |
| 1779 | + "name": "Generate File", |
| 1780 | + "isEnabled": True, |
| 1781 | + "description": "Create a file and attach it to the job.", |
| 1782 | + "properties": {"toolType": "generate-file"}, |
| 1783 | + "inputSchema": { |
| 1784 | + "type": "object", |
| 1785 | + "properties": {"file_name": {"type": "string"}}, |
| 1786 | + "required": ["file_name"], |
| 1787 | + }, |
| 1788 | + "outputSchema": {"type": "object", "properties": {}}, |
| 1789 | + "settings": {}, |
| 1790 | + "argumentProperties": {}, |
| 1791 | + "guardrail": {"policies": []}, |
| 1792 | + } |
| 1793 | + ], |
| 1794 | + "messages": [{"role": "system", "content": "Test system message"}], |
| 1795 | + } |
| 1796 | + |
| 1797 | + config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python( |
| 1798 | + json_data |
| 1799 | + ) |
| 1800 | + |
| 1801 | + tool_resource = config.resources[0] |
| 1802 | + assert isinstance(tool_resource, AgentInternalToolResourceConfig) |
| 1803 | + assert isinstance( |
| 1804 | + tool_resource.properties, AgentInternalGenerateFileToolProperties |
| 1805 | + ) |
| 1806 | + assert tool_resource.properties.tool_type == AgentInternalToolType.GENERATE_FILE |
| 1807 | + |
1760 | 1808 | def test_agent_with_unknown_tool_type(self): |
1761 | 1809 | """Test that AgentDefinition handles unknown tool types gracefully""" |
1762 | 1810 |
|
|
0 commit comments