vellum-ai 1.1.5__py3-none-any.whl → 1.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. vellum/__init__.py +18 -1
  2. vellum/client/__init__.py +3 -0
  3. vellum/client/core/client_wrapper.py +2 -2
  4. vellum/client/errors/__init__.py +10 -1
  5. vellum/client/errors/too_many_requests_error.py +11 -0
  6. vellum/client/errors/unauthorized_error.py +11 -0
  7. vellum/client/reference.md +94 -0
  8. vellum/client/resources/__init__.py +2 -0
  9. vellum/client/resources/events/__init__.py +4 -0
  10. vellum/client/resources/events/client.py +165 -0
  11. vellum/client/resources/events/raw_client.py +207 -0
  12. vellum/client/types/__init__.py +6 -0
  13. vellum/client/types/error_detail_response.py +22 -0
  14. vellum/client/types/event_create_response.py +26 -0
  15. vellum/client/types/execution_thinking_vellum_value.py +1 -1
  16. vellum/client/types/thinking_vellum_value.py +1 -1
  17. vellum/client/types/thinking_vellum_value_request.py +1 -1
  18. vellum/client/types/workflow_event.py +33 -0
  19. vellum/errors/too_many_requests_error.py +3 -0
  20. vellum/errors/unauthorized_error.py +3 -0
  21. vellum/resources/events/__init__.py +3 -0
  22. vellum/resources/events/client.py +3 -0
  23. vellum/resources/events/raw_client.py +3 -0
  24. vellum/types/error_detail_response.py +3 -0
  25. vellum/types/event_create_response.py +3 -0
  26. vellum/types/workflow_event.py +3 -0
  27. vellum/workflows/nodes/displayable/bases/api_node/node.py +4 -0
  28. vellum/workflows/nodes/displayable/bases/api_node/tests/test_node.py +26 -0
  29. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +6 -1
  30. vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py +22 -0
  31. vellum/workflows/sandbox.py +28 -8
  32. vellum/workflows/state/encoder.py +19 -1
  33. vellum/workflows/utils/hmac.py +44 -0
  34. {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/METADATA +1 -1
  35. {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/RECORD +61 -43
  36. vellum_ee/workflows/display/nodes/base_node_display.py +2 -2
  37. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +37 -7
  38. vellum_ee/workflows/display/nodes/vellum/retry_node.py +1 -1
  39. vellum_ee/workflows/display/nodes/vellum/tests/test_retry_node.py +1 -1
  40. vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +314 -2
  41. vellum_ee/workflows/display/nodes/vellum/try_node.py +1 -1
  42. vellum_ee/workflows/display/tests/test_base_workflow_display.py +53 -1
  43. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +9 -9
  44. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +9 -9
  45. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +3 -3
  46. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +14 -15
  47. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +58 -3
  48. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +1 -1
  49. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py +4 -0
  50. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +1 -1
  51. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_inline_workflow_serialization.py +2 -2
  52. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py +1 -1
  53. vellum_ee/workflows/display/utils/expressions.py +9 -1
  54. vellum_ee/workflows/display/utils/registry.py +46 -0
  55. vellum_ee/workflows/display/workflows/base_workflow_display.py +21 -1
  56. vellum_ee/workflows/tests/test_registry.py +169 -0
  57. vellum_ee/workflows/tests/test_serialize_module.py +31 -0
  58. vellum_ee/workflows/tests/test_server.py +72 -0
  59. {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/LICENSE +0 -0
  60. {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/WHEEL +0 -0
  61. {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/entry_points.txt +0 -0
@@ -8,6 +8,7 @@ from vellum.client.types.number_vellum_value import NumberVellumValue
8
8
  from vellum.workflows import BaseWorkflow
9
9
  from vellum.workflows.nodes import BaseNode
10
10
  from vellum.workflows.state.context import WorkflowContext
11
+ from vellum_ee.workflows.display.workflows.base_workflow_display import BaseWorkflowDisplay
11
12
  from vellum_ee.workflows.server.virtual_file_loader import VirtualFileFinder
12
13
 
13
14
 
@@ -494,3 +495,74 @@ class MapNodeWorkflow(BaseWorkflow):
494
495
 
495
496
  # AND we get the map node results as a list
496
497
  assert event.body.outputs == {"results": [1.0, 1.0, 1.0]}
498
+
499
+
500
+ def test_serialize_module__tool_calling_node_with_single_tool():
501
+ """Test that serialize_module works with a tool calling node that has a single tool."""
502
+
503
+ # GIVEN a simple tool function
504
+ tool_function_code = '''def get_weather(location: str) -> str:
505
+ """Get the current weather for a location."""
506
+ return f"The weather in {location} is sunny."
507
+ '''
508
+
509
+ # AND a workflow module with a tool calling node using that single tool
510
+ files = {
511
+ "__init__.py": "",
512
+ "workflow.py": """
513
+ from vellum.workflows import BaseWorkflow
514
+ from vellum.workflows.nodes.displayable.tool_calling_node import ToolCallingNode
515
+ from vellum.workflows.state.base import BaseState
516
+ from vellum.workflows.workflows.base import BaseInputs
517
+ from vellum.client.types.chat_message_prompt_block import ChatMessagePromptBlock
518
+ from vellum.client.types.plain_text_prompt_block import PlainTextPromptBlock
519
+ from vellum.client.types.rich_text_prompt_block import RichTextPromptBlock
520
+ from vellum.client.types.variable_prompt_block import VariablePromptBlock
521
+
522
+ from .get_weather import get_weather
523
+
524
+
525
+ class Inputs(BaseInputs):
526
+ location: str
527
+
528
+
529
+ class WeatherNode(ToolCallingNode):
530
+ ml_model = "gpt-4o-mini"
531
+ blocks = [
532
+ ChatMessagePromptBlock(
533
+ chat_role="USER",
534
+ blocks=[
535
+ RichTextPromptBlock(
536
+ blocks=[
537
+ VariablePromptBlock(
538
+ input_variable="location",
539
+ ),
540
+ ],
541
+ ),
542
+ ],
543
+ ),
544
+ ]
545
+ functions = [get_weather]
546
+ prompt_inputs = {
547
+ "location": Inputs.location,
548
+ }
549
+
550
+
551
+ class Workflow(BaseWorkflow[Inputs, BaseState]):
552
+ graph = WeatherNode
553
+
554
+ class Outputs(BaseWorkflow.Outputs):
555
+ result = WeatherNode.Outputs.text
556
+ """,
557
+ "get_weather.py": tool_function_code,
558
+ }
559
+
560
+ namespace = str(uuid4())
561
+
562
+ # AND the virtual file loader is registered
563
+ sys.meta_path.append(VirtualFileFinder(files, namespace))
564
+
565
+ result = BaseWorkflowDisplay.serialize_module(namespace)
566
+
567
+ # THEN the serialization should complete successfully
568
+ assert result is not None