From 9a65abf6b81038128f0c0977d9ecb132a7292382 Mon Sep 17 00:00:00 2001 From: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:54:16 -0800 Subject: [PATCH 01/23] removed some redundancies (#1796) * removed some redundancies * cleanup --- .../source/base_file_knowledge_source.py | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/crewai/knowledge/source/base_file_knowledge_source.py b/src/crewai/knowledge/source/base_file_knowledge_source.py index e086cbf65..8cee77e16 100644 --- a/src/crewai/knowledge/source/base_file_knowledge_source.py +++ b/src/crewai/knowledge/source/base_file_knowledge_source.py @@ -71,28 +71,29 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC): def _process_file_paths(self) -> List[Path]: """Convert file_path to a list of Path objects.""" - # Check if old file_path is being used if hasattr(self, "file_path") and self.file_path is not None: self._logger.log( "warning", "The 'file_path' attribute is deprecated and will be removed in a future version. Please use 'file_paths' instead.", color="yellow", ) - paths = ( - [self.file_path] - if isinstance(self.file_path, (str, Path)) - else self.file_path - ) - else: - if self.file_paths is None: - raise ValueError("Your source must be provided with a file_paths: []") - elif isinstance(self.file_paths, list) and len(self.file_paths) == 0: - raise ValueError("Empty file_paths are not allowed") - else: - paths = ( - [self.file_paths] - if isinstance(self.file_paths, (str, Path)) - else self.file_paths - ) + self.file_paths = self.file_path - return [self.convert_to_path(path) for path in paths] + if self.file_paths is None: + raise ValueError("Your source must be provided with a file_paths: []") + + # Convert single path to list + path_list: List[Union[Path, str]] = ( + [self.file_paths] + if isinstance(self.file_paths, (str, Path)) + else list(self.file_paths) + if isinstance(self.file_paths, list) + else [] + ) + + if not path_list: + raise ValueError( + "file_path/file_paths must be a Path, str, or a list of these types" + ) + + return [self.convert_to_path(path) for path in path_list] From 6cc2f510bf737b0053ae01a8a6d5582086ae5ec0 Mon Sep 17 00:00:00 2001 From: "Brandon Hancock (bhancock_ai)" <109994880+bhancockio@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:55:44 -0500 Subject: [PATCH 02/23] Feat/joao flow improvement requests (#1795) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add in or and and in router * In the middle of improving plotting * final plot changes --------- Co-authored-by: João Moura --- src/crewai/flow/flow.py | 155 +++++++++++-------------- src/crewai/flow/utils.py | 54 +++++++-- src/crewai/flow/visualization_utils.py | 90 +++++++++----- tests/flow_test.py | 59 ++++++++++ 4 files changed, 233 insertions(+), 125 deletions(-) diff --git a/src/crewai/flow/flow.py b/src/crewai/flow/flow.py index ccc76dc95..4a6361cce 100644 --- a/src/crewai/flow/flow.py +++ b/src/crewai/flow/flow.py @@ -80,10 +80,27 @@ def listen(condition): return decorator -def router(method): +def router(condition): def decorator(func): func.__is_router__ = True - func.__router_for__ = method.__name__ + # Handle conditions like listen/start + if isinstance(condition, str): + func.__trigger_methods__ = [condition] + func.__condition_type__ = "OR" + elif ( + isinstance(condition, dict) + and "type" in condition + and "methods" in condition + ): + func.__trigger_methods__ = condition["methods"] + func.__condition_type__ = condition["type"] + elif callable(condition) and hasattr(condition, "__name__"): + func.__trigger_methods__ = [condition.__name__] + func.__condition_type__ = "OR" + else: + raise ValueError( + "Condition must be a method, string, or a result of or_() or and_()" + ) return func return decorator @@ -123,8 +140,8 @@ class FlowMeta(type): start_methods = [] listeners = {} - routers = {} router_paths = {} + routers = set() for attr_name, attr_value in dct.items(): if hasattr(attr_value, "__is_start_method__"): @@ -137,18 +154,11 @@ class FlowMeta(type): methods = attr_value.__trigger_methods__ condition_type = getattr(attr_value, "__condition_type__", "OR") listeners[attr_name] = (condition_type, methods) - - elif hasattr(attr_value, "__is_router__"): - routers[attr_value.__router_for__] = attr_name - possible_returns = get_possible_return_constants(attr_value) - if possible_returns: - router_paths[attr_name] = possible_returns - - # Register router as a listener to its triggering method - trigger_method_name = attr_value.__router_for__ - methods = [trigger_method_name] - condition_type = "OR" - listeners[attr_name] = (condition_type, methods) + if hasattr(attr_value, "__is_router__") and attr_value.__is_router__: + routers.add(attr_name) + possible_returns = get_possible_return_constants(attr_value) + if possible_returns: + router_paths[attr_name] = possible_returns setattr(cls, "_start_methods", start_methods) setattr(cls, "_listeners", listeners) @@ -163,7 +173,7 @@ class Flow(Generic[T], metaclass=FlowMeta): _start_methods: List[str] = [] _listeners: Dict[str, tuple[str, List[str]]] = {} - _routers: Dict[str, str] = {} + _routers: Set[str] = set() _router_paths: Dict[str, List[str]] = {} initial_state: Union[Type[T], T, None] = None event_emitter = Signal("event_emitter") @@ -210,20 +220,10 @@ class Flow(Generic[T], metaclass=FlowMeta): return self._method_outputs def _initialize_state(self, inputs: Dict[str, Any]) -> None: - """ - Initializes or updates the state with the provided inputs. - - Args: - inputs: Dictionary of inputs to initialize or update the state. - - Raises: - ValueError: If inputs do not match the structured state model. - TypeError: If state is neither a BaseModel instance nor a dictionary. - """ if isinstance(self._state, BaseModel): - # Structured state management + # Structured state try: - # Define a function to create the dynamic class + def create_model_with_extra_forbid( base_model: Type[BaseModel], ) -> Type[BaseModel]: @@ -233,34 +233,20 @@ class Flow(Generic[T], metaclass=FlowMeta): return ModelWithExtraForbid - # Create the dynamic class ModelWithExtraForbid = create_model_with_extra_forbid( self._state.__class__ ) - - # Create a new instance using the combined state and inputs self._state = cast( T, ModelWithExtraForbid(**{**self._state.model_dump(), **inputs}) ) - except ValidationError as e: raise ValueError(f"Invalid inputs for structured state: {e}") from e elif isinstance(self._state, dict): - # Unstructured state management self._state.update(inputs) else: raise TypeError("State must be a BaseModel instance or a dictionary.") def kickoff(self, inputs: Optional[Dict[str, Any]] = None) -> Any: - """ - Starts the execution of the flow synchronously. - - Args: - inputs: Optional dictionary of inputs to initialize or update the state. - - Returns: - The final output from the flow execution. - """ self.event_emitter.send( self, event=FlowStartedEvent( @@ -274,15 +260,6 @@ class Flow(Generic[T], metaclass=FlowMeta): return asyncio.run(self.kickoff_async()) async def kickoff_async(self, inputs: Optional[Dict[str, Any]] = None) -> Any: - """ - Starts the execution of the flow asynchronously. - - Args: - inputs: Optional dictionary of inputs to initialize or update the state. - - Returns: - The final output from the flow execution. - """ if not self._start_methods: raise ValueError("No start method defined") @@ -290,16 +267,12 @@ class Flow(Generic[T], metaclass=FlowMeta): self.__class__.__name__, list(self._methods.keys()) ) - # Create tasks for all start methods tasks = [ self._execute_start_method(start_method) for start_method in self._start_methods ] - - # Run all start methods concurrently await asyncio.gather(*tasks) - # Determine the final output (from the last executed method) final_output = self._method_outputs[-1] if self._method_outputs else None self.event_emitter.send( @@ -310,7 +283,6 @@ class Flow(Generic[T], metaclass=FlowMeta): result=final_output, ), ) - return final_output async def _execute_start_method(self, start_method_name: str) -> None: @@ -327,49 +299,68 @@ class Flow(Generic[T], metaclass=FlowMeta): if asyncio.iscoroutinefunction(method) else method(*args, **kwargs) ) - self._method_outputs.append(result) # Store the output - - # Track method execution counts + self._method_outputs.append(result) self._method_execution_counts[method_name] = ( self._method_execution_counts.get(method_name, 0) + 1 ) - return result async def _execute_listeners(self, trigger_method: str, result: Any) -> None: - listener_tasks = [] - - if trigger_method in self._routers: - router_method = self._methods[self._routers[trigger_method]] - path = await self._execute_method( - self._routers[trigger_method], router_method + # First, handle routers repeatedly until no router triggers anymore + while True: + routers_triggered = self._find_triggered_methods( + trigger_method, router_only=True ) - trigger_method = path + if not routers_triggered: + break + for router_name in routers_triggered: + await self._execute_single_listener(router_name, result) + # After executing router, the router's result is the path + # The last router executed sets the trigger_method + # The router result is the last element in self._method_outputs + trigger_method = self._method_outputs[-1] + # Now that no more routers are triggered by current trigger_method, + # execute normal listeners + listeners_triggered = self._find_triggered_methods( + trigger_method, router_only=False + ) + if listeners_triggered: + tasks = [ + self._execute_single_listener(listener_name, result) + for listener_name in listeners_triggered + ] + await asyncio.gather(*tasks) + + def _find_triggered_methods( + self, trigger_method: str, router_only: bool + ) -> List[str]: + triggered = [] for listener_name, (condition_type, methods) in self._listeners.items(): + is_router = listener_name in self._routers + + if router_only != is_router: + continue + if condition_type == "OR": + # If the trigger_method matches any in methods, run this if trigger_method in methods: - # Schedule the listener without preventing re-execution - listener_tasks.append( - self._execute_single_listener(listener_name, result) - ) + triggered.append(listener_name) elif condition_type == "AND": # Initialize pending methods for this listener if not already done if listener_name not in self._pending_and_listeners: self._pending_and_listeners[listener_name] = set(methods) # Remove the trigger method from pending methods - self._pending_and_listeners[listener_name].discard(trigger_method) + if trigger_method in self._pending_and_listeners[listener_name]: + self._pending_and_listeners[listener_name].discard(trigger_method) + if not self._pending_and_listeners[listener_name]: # All required methods have been executed - listener_tasks.append( - self._execute_single_listener(listener_name, result) - ) + triggered.append(listener_name) # Reset pending methods for this listener self._pending_and_listeners.pop(listener_name, None) - # Run all listener tasks concurrently and wait for them to complete - if listener_tasks: - await asyncio.gather(*listener_tasks) + return triggered async def _execute_single_listener(self, listener_name: str, result: Any) -> None: try: @@ -386,17 +377,13 @@ class Flow(Generic[T], metaclass=FlowMeta): sig = inspect.signature(method) params = list(sig.parameters.values()) - - # Exclude 'self' parameter method_params = [p for p in params if p.name != "self"] if method_params: - # If listener expects parameters, pass the result listener_result = await self._execute_method( listener_name, method, result ) else: - # If listener does not expect parameters, call without arguments listener_result = await self._execute_method(listener_name, method) self.event_emitter.send( @@ -408,8 +395,9 @@ class Flow(Generic[T], metaclass=FlowMeta): ), ) - # Execute listeners of this listener + # Execute listeners (and possibly routers) of this listener await self._execute_listeners(listener_name, listener_result) + except Exception as e: print( f"[Flow._execute_single_listener] Error in method {listener_name}: {e}" @@ -422,5 +410,4 @@ class Flow(Generic[T], metaclass=FlowMeta): self._telemetry.flow_plotting_span( self.__class__.__name__, list(self._methods.keys()) ) - plot_flow(self, filename) diff --git a/src/crewai/flow/utils.py b/src/crewai/flow/utils.py index 98d03f24f..dc1f611fb 100644 --- a/src/crewai/flow/utils.py +++ b/src/crewai/flow/utils.py @@ -31,16 +31,50 @@ def get_possible_return_constants(function): print(f"Source code:\n{source}") return None - return_values = [] + return_values = set() + dict_definitions = {} + + class DictionaryAssignmentVisitor(ast.NodeVisitor): + def visit_Assign(self, node): + # Check if this assignment is assigning a dictionary literal to a variable + if isinstance(node.value, ast.Dict) and len(node.targets) == 1: + target = node.targets[0] + if isinstance(target, ast.Name): + var_name = target.id + dict_values = [] + # Extract string values from the dictionary + for val in node.value.values: + if isinstance(val, ast.Constant) and isinstance(val.value, str): + dict_values.append(val.value) + # If non-string, skip or just ignore + if dict_values: + dict_definitions[var_name] = dict_values + self.generic_visit(node) class ReturnVisitor(ast.NodeVisitor): def visit_Return(self, node): - # Check if the return value is a constant (Python 3.8+) - if isinstance(node.value, ast.Constant): - return_values.append(node.value.value) + # Direct string return + if isinstance(node.value, ast.Constant) and isinstance( + node.value.value, str + ): + return_values.add(node.value.value) + # Dictionary-based return, like return paths[result] + elif isinstance(node.value, ast.Subscript): + # Check if we're subscripting a known dictionary variable + if isinstance(node.value.value, ast.Name): + var_name = node.value.value.id + if var_name in dict_definitions: + # Add all possible dictionary values + for v in dict_definitions[var_name]: + return_values.add(v) + self.generic_visit(node) + # First pass: identify dictionary assignments + DictionaryAssignmentVisitor().visit(code_ast) + # Second pass: identify returns ReturnVisitor().visit(code_ast) - return return_values + + return list(return_values) if return_values else None def calculate_node_levels(flow): @@ -61,10 +95,7 @@ def calculate_node_levels(flow): current_level = levels[current] visited.add(current) - for listener_name, ( - condition_type, - trigger_methods, - ) in flow._listeners.items(): + for listener_name, (condition_type, trigger_methods) in flow._listeners.items(): if condition_type == "OR": if current in trigger_methods: if ( @@ -89,7 +120,7 @@ def calculate_node_levels(flow): queue.append(listener_name) # Handle router connections - if current in flow._routers.values(): + if current in flow._routers: router_method_name = current paths = flow._router_paths.get(router_method_name, []) for path in paths: @@ -105,6 +136,7 @@ def calculate_node_levels(flow): levels[listener_name] = current_level + 1 if listener_name not in visited: queue.append(listener_name) + return levels @@ -142,7 +174,7 @@ def dfs_ancestors(node, ancestors, visited, flow): dfs_ancestors(listener_name, ancestors, visited, flow) # Handle router methods separately - if node in flow._routers.values(): + if node in flow._routers: router_method_name = node paths = flow._router_paths.get(router_method_name, []) for path in paths: diff --git a/src/crewai/flow/visualization_utils.py b/src/crewai/flow/visualization_utils.py index 5b95a1369..321f63344 100644 --- a/src/crewai/flow/visualization_utils.py +++ b/src/crewai/flow/visualization_utils.py @@ -94,12 +94,14 @@ def add_edges(net, flow, node_positions, colors): ancestors = build_ancestor_dict(flow) parent_children = build_parent_children_dict(flow) + # Edges for normal listeners for method_name in flow._listeners: condition_type, trigger_methods = flow._listeners[method_name] is_and_condition = condition_type == "AND" for trigger in trigger_methods: - if trigger in flow._methods or trigger in flow._routers.values(): + # Check if nodes exist before adding edges + if trigger in node_positions and method_name in node_positions: is_router_edge = any( trigger in paths for paths in flow._router_paths.values() ) @@ -135,7 +137,22 @@ def add_edges(net, flow, node_positions, colors): } net.add_edge(trigger, method_name, **edge_style) + else: + # Nodes not found in node_positions. Check if it's a known router outcome and a known method. + is_router_edge = any( + trigger in paths for paths in flow._router_paths.values() + ) + # Check if method_name is a known method + method_known = method_name in flow._methods + # If it's a known router edge and the method is known, don't warn. + # This means the path is legitimate, just not reflected as nodes here. + if not (is_router_edge and method_known): + print( + f"Warning: No node found for '{trigger}' or '{method_name}'. Skipping edge." + ) + + # Edges for router return paths for router_method_name, paths in flow._router_paths.items(): for path in paths: for listener_name, ( @@ -143,36 +160,49 @@ def add_edges(net, flow, node_positions, colors): trigger_methods, ) in flow._listeners.items(): if path in trigger_methods: - is_cycle_edge = is_ancestor(trigger, method_name, ancestors) - parent_has_multiple_children = ( - len(parent_children.get(router_method_name, [])) > 1 - ) - needs_curvature = is_cycle_edge or parent_has_multiple_children + if ( + router_method_name in node_positions + and listener_name in node_positions + ): + is_cycle_edge = is_ancestor( + router_method_name, listener_name, ancestors + ) + parent_has_multiple_children = ( + len(parent_children.get(router_method_name, [])) > 1 + ) + needs_curvature = is_cycle_edge or parent_has_multiple_children - if needs_curvature: - source_pos = node_positions.get(router_method_name) - target_pos = node_positions.get(listener_name) + if needs_curvature: + source_pos = node_positions.get(router_method_name) + target_pos = node_positions.get(listener_name) - if source_pos and target_pos: - dx = target_pos[0] - source_pos[0] - smooth_type = "curvedCCW" if dx <= 0 else "curvedCW" - index = get_child_index( - router_method_name, listener_name, parent_children - ) - edge_smooth = { - "type": smooth_type, - "roundness": 0.2 + (0.1 * index), - } + if source_pos and target_pos: + dx = target_pos[0] - source_pos[0] + smooth_type = "curvedCCW" if dx <= 0 else "curvedCW" + index = get_child_index( + router_method_name, listener_name, parent_children + ) + edge_smooth = { + "type": smooth_type, + "roundness": 0.2 + (0.1 * index), + } + else: + edge_smooth = {"type": "cubicBezier"} else: - edge_smooth = {"type": "cubicBezier"} - else: - edge_smooth = False + edge_smooth = False - edge_style = { - "color": colors["router_edge"], - "width": 2, - "arrows": "to", - "dashes": True, - "smooth": edge_smooth, - } - net.add_edge(router_method_name, listener_name, **edge_style) + edge_style = { + "color": colors["router_edge"], + "width": 2, + "arrows": "to", + "dashes": True, + "smooth": edge_smooth, + } + net.add_edge(router_method_name, listener_name, **edge_style) + else: + # Same check here: known router edge and known method? + method_known = listener_name in flow._methods + if not method_known: + print( + f"Warning: No node found for '{router_method_name}' or '{listener_name}'. Skipping edge." + ) diff --git a/tests/flow_test.py b/tests/flow_test.py index 2e2020361..d52c459ce 100644 --- a/tests/flow_test.py +++ b/tests/flow_test.py @@ -263,3 +263,62 @@ def test_flow_with_custom_state(): flow = StateFlow() flow.kickoff() assert flow.counter == 2 + + +def test_router_with_multiple_conditions(): + """Test a router that triggers when any of multiple steps complete (OR condition), + and another router that triggers only after all specified steps complete (AND condition). + """ + + execution_order = [] + + class ComplexRouterFlow(Flow): + @start() + def step_a(self): + execution_order.append("step_a") + + @start() + def step_b(self): + execution_order.append("step_b") + + @router(or_("step_a", "step_b")) + def router_or(self): + execution_order.append("router_or") + return "next_step_or" + + @listen("next_step_or") + def handle_next_step_or_event(self): + execution_order.append("handle_next_step_or_event") + + @listen(handle_next_step_or_event) + def branch_2_step(self): + execution_order.append("branch_2_step") + + @router(and_(handle_next_step_or_event, branch_2_step)) + def router_and(self): + execution_order.append("router_and") + return "final_step" + + @listen("final_step") + def log_final_step(self): + execution_order.append("log_final_step") + + flow = ComplexRouterFlow() + flow.kickoff() + + assert "step_a" in execution_order + assert "step_b" in execution_order + assert "router_or" in execution_order + assert "handle_next_step_or_event" in execution_order + assert "branch_2_step" in execution_order + assert "router_and" in execution_order + assert "log_final_step" in execution_order + + # Check that the AND router triggered after both relevant steps: + assert execution_order.index("router_and") > execution_order.index( + "handle_next_step_or_event" + ) + assert execution_order.index("router_and") > execution_order.index("branch_2_step") + + # final_step should run after router_and + assert execution_order.index("log_final_step") > execution_order.index("router_and") From 82647358b26f4f214d08c5a4cd85e7ebedd7366a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Fri, 27 Dec 2024 17:03:35 -0300 Subject: [PATCH 03/23] Adding Multimodal Abilities to Crew (#1805) * initial fix on delegation tools * fixing tests for delegations and coding * Refactor prepare tool and adding initial add images logic * supporting image tool * fixing linter * fix linter * Making sure multimodal feature support i18n * fix linter and types * mixxing translations * fix types and linter * Revert "fixing linter" This reverts commit 2eda5fdeed6f97b1e9c5bff4a124832f8e6c1f1e. * fix linters * test * fix * fix * fix linter * fix * ignore * type improvements --- src/crewai/agent.py | 9 + src/crewai/agents/crew_agent_executor.py | 16 +- src/crewai/crew.py | 112 ++-- src/crewai/llm.py | 2 + .../tools/agent_tools/add_image_tool.py | 45 ++ src/crewai/tools/agent_tools/agent_tools.py | 4 +- src/crewai/tools/tool_usage.py | 17 +- src/crewai/translations/en.json | 7 +- src/crewai/utilities/i18n.py | 6 +- .../test_crew_with_delegating_agents.yaml | 556 +++------------- ...gents_should_not_override_agent_tools.yaml | 480 ++++++++++++++ ...agents_should_not_override_task_tools.yaml | 623 ++++++++++++++++++ ..._multimodal_agent_live_image_analysis.yaml | 481 ++++++++++++++ .../test_task_tools_override_agent_tools.yaml | 569 ++++++++++++++++ tests/crew_test.py | 611 ++++++++++++++++- 15 files changed, 2992 insertions(+), 546 deletions(-) create mode 100644 src/crewai/tools/agent_tools/add_image_tool.py create mode 100644 tests/cassettes/test_crew_with_delegating_agents_should_not_override_agent_tools.yaml create mode 100644 tests/cassettes/test_crew_with_delegating_agents_should_not_override_task_tools.yaml create mode 100644 tests/cassettes/test_multimodal_agent_live_image_analysis.yaml create mode 100644 tests/cassettes/test_task_tools_override_agent_tools.yaml diff --git a/src/crewai/agent.py b/src/crewai/agent.py index cdad8263a..999d1d800 100644 --- a/src/crewai/agent.py +++ b/src/crewai/agent.py @@ -17,6 +17,7 @@ from crewai.memory.contextual.contextual_memory import ContextualMemory from crewai.task import Task from crewai.tools import BaseTool from crewai.tools.agent_tools.agent_tools import AgentTools +from crewai.tools.base_tool import Tool from crewai.utilities import Converter, Prompts from crewai.utilities.constants import TRAINED_AGENTS_DATA_FILE, TRAINING_DATA_FILE from crewai.utilities.converter import generate_model_description @@ -114,6 +115,10 @@ class Agent(BaseAgent): default=2, description="Maximum number of retries for an agent to execute a task when an error occurs.", ) + multimodal: bool = Field( + default=False, + description="Whether the agent is multimodal.", + ) code_execution_mode: Literal["safe", "unsafe"] = Field( default="safe", description="Mode for code execution: 'safe' (using Docker) or 'unsafe' (direct execution).", @@ -406,6 +411,10 @@ class Agent(BaseAgent): tools = agent_tools.tools() return tools + def get_multimodal_tools(self) -> List[Tool]: + from crewai.tools.agent_tools.add_image_tool import AddImageTool + return [AddImageTool()] + def get_code_execution_tools(self): try: from crewai_tools import CodeInterpreterTool diff --git a/src/crewai/agents/crew_agent_executor.py b/src/crewai/agents/crew_agent_executor.py index eb0ff7c5a..813ac8a08 100644 --- a/src/crewai/agents/crew_agent_executor.py +++ b/src/crewai/agents/crew_agent_executor.py @@ -143,10 +143,20 @@ class CrewAgentExecutor(CrewAgentExecutorMixin): tool_result = self._execute_tool_and_check_finality( formatted_answer ) - if self.step_callback: - self.step_callback(tool_result) - formatted_answer.text += f"\nObservation: {tool_result.result}" + # Directly append the result to the messages if the + # tool is "Add image to content" in case of multimodal + # agents + if formatted_answer.tool == self._i18n.tools("add_image")["name"]: + self.messages.append(tool_result.result) + continue + + else: + if self.step_callback: + self.step_callback(tool_result) + + formatted_answer.text += f"\nObservation: {tool_result.result}" + formatted_answer.result = tool_result.result if tool_result.result_as_answer: return AgentFinish( diff --git a/src/crewai/crew.py b/src/crewai/crew.py index 8138781cc..d488783ea 100644 --- a/src/crewai/crew.py +++ b/src/crewai/crew.py @@ -35,6 +35,7 @@ from crewai.tasks.conditional_task import ConditionalTask from crewai.tasks.task_output import TaskOutput from crewai.telemetry import Telemetry from crewai.tools.agent_tools.agent_tools import AgentTools +from crewai.tools.base_tool import Tool from crewai.types.usage_metrics import UsageMetrics from crewai.utilities import I18N, FileHandler, Logger, RPMController from crewai.utilities.constants import TRAINING_DATA_FILE @@ -533,9 +534,6 @@ class Crew(BaseModel): if not agent.function_calling_llm: # type: ignore # "BaseAgent" has no attribute "function_calling_llm" agent.function_calling_llm = self.function_calling_llm # type: ignore # "BaseAgent" has no attribute "function_calling_llm" - if agent.allow_code_execution: # type: ignore # BaseAgent" has no attribute "allow_code_execution" - agent.tools += agent.get_code_execution_tools() # type: ignore # "BaseAgent" has no attribute "get_code_execution_tools"; maybe "get_delegation_tools"? - if not agent.step_callback: # type: ignore # "BaseAgent" has no attribute "step_callback" agent.step_callback = self.step_callback # type: ignore # "BaseAgent" has no attribute "step_callback" @@ -672,7 +670,6 @@ class Crew(BaseModel): ) manager.tools = [] raise Exception("Manager agent should not have tools") - manager.tools = self.manager_agent.get_delegation_tools(self.agents) else: self.manager_llm = ( getattr(self.manager_llm, "model_name", None) @@ -684,6 +681,7 @@ class Crew(BaseModel): goal=i18n.retrieve("hierarchical_manager_agent", "goal"), backstory=i18n.retrieve("hierarchical_manager_agent", "backstory"), tools=AgentTools(agents=self.agents).tools(), + allow_delegation=True, llm=self.manager_llm, verbose=self.verbose, ) @@ -726,7 +724,14 @@ class Crew(BaseModel): f"No agent available for task: {task.description}. Ensure that either the task has an assigned agent or a manager agent is provided." ) - self._prepare_agent_tools(task) + # Determine which tools to use - task tools take precedence over agent tools + tools_for_task = task.tools or agent_to_use.tools or [] + tools_for_task = self._prepare_tools( + agent_to_use, + task, + tools_for_task + ) + self._log_task_start(task, agent_to_use.role) if isinstance(task, ConditionalTask): @@ -743,7 +748,7 @@ class Crew(BaseModel): future = task.execute_async( agent=agent_to_use, context=context, - tools=agent_to_use.tools, + tools=tools_for_task, ) futures.append((task, future, task_index)) else: @@ -755,7 +760,7 @@ class Crew(BaseModel): task_output = task.execute_sync( agent=agent_to_use, context=context, - tools=agent_to_use.tools, + tools=tools_for_task, ) task_outputs = [task_output] self._process_task_result(task, task_output) @@ -792,45 +797,67 @@ class Crew(BaseModel): return skipped_task_output return None - def _prepare_agent_tools(self, task: Task): - if self.process == Process.hierarchical: - if self.manager_agent: - self._update_manager_tools(task) - else: - raise ValueError("Manager agent is required for hierarchical process.") - elif task.agent and task.agent.allow_delegation: - self._add_delegation_tools(task) + def _prepare_tools(self, agent: BaseAgent, task: Task, tools: List[Tool]) -> List[Tool]: + # Add delegation tools if agent allows delegation + if agent.allow_delegation: + if self.process == Process.hierarchical: + if self.manager_agent: + tools = self._update_manager_tools(task, tools) + else: + raise ValueError("Manager agent is required for hierarchical process.") + + elif agent and agent.allow_delegation: + tools = self._add_delegation_tools(task, tools) + + # Add code execution tools if agent allows code execution + if agent.allow_code_execution: + tools = self._add_code_execution_tools(agent, tools) + + if agent and agent.multimodal: + tools = self._add_multimodal_tools(agent, tools) + + return tools def _get_agent_to_use(self, task: Task) -> Optional[BaseAgent]: if self.process == Process.hierarchical: return self.manager_agent return task.agent - def _add_delegation_tools(self, task: Task): + def _merge_tools(self, existing_tools: List[Tool], new_tools: List[Tool]) -> List[Tool]: + """Merge new tools into existing tools list, avoiding duplicates by tool name.""" + if not new_tools: + return existing_tools + + # Create mapping of tool names to new tools + new_tool_map = {tool.name: tool for tool in new_tools} + + # Remove any existing tools that will be replaced + tools = [tool for tool in existing_tools if tool.name not in new_tool_map] + + # Add all new tools + tools.extend(new_tools) + + return tools + + def _inject_delegation_tools(self, tools: List[Tool], task_agent: BaseAgent, agents: List[BaseAgent]): + delegation_tools = task_agent.get_delegation_tools(agents) + return self._merge_tools(tools, delegation_tools) + + def _add_multimodal_tools(self, agent: BaseAgent, tools: List[Tool]): + multimodal_tools = agent.get_multimodal_tools() + return self._merge_tools(tools, multimodal_tools) + + def _add_code_execution_tools(self, agent: BaseAgent, tools: List[Tool]): + code_tools = agent.get_code_execution_tools() + return self._merge_tools(tools, code_tools) + + def _add_delegation_tools(self, task: Task, tools: List[Tool]): agents_for_delegation = [agent for agent in self.agents if agent != task.agent] if len(self.agents) > 1 and len(agents_for_delegation) > 0 and task.agent: - delegation_tools = task.agent.get_delegation_tools(agents_for_delegation) - - # Add tools if they are not already in task.tools - for new_tool in delegation_tools: - # Find the index of the tool with the same name - existing_tool_index = next( - ( - index - for index, tool in enumerate(task.tools or []) - if tool.name == new_tool.name - ), - None, - ) - if not task.tools: - task.tools = [] - - if existing_tool_index is not None: - # Replace the existing tool - task.tools[existing_tool_index] = new_tool - else: - # Add the new tool - task.tools.append(new_tool) + if not tools: + tools = [] + tools = self._inject_delegation_tools(tools, task.agent, agents_for_delegation) + return tools def _log_task_start(self, task: Task, role: str = "None"): if self.output_log_file: @@ -838,14 +865,13 @@ class Crew(BaseModel): task_name=task.name, task=task.description, agent=role, status="started" ) - def _update_manager_tools(self, task: Task): + def _update_manager_tools(self, task: Task, tools: List[Tool]): if self.manager_agent: if task.agent: - self.manager_agent.tools = task.agent.get_delegation_tools([task.agent]) + tools = self._inject_delegation_tools(tools, task.agent, [task.agent]) else: - self.manager_agent.tools = self.manager_agent.get_delegation_tools( - self.agents - ) + tools = self._inject_delegation_tools(tools, self.manager_agent, self.agents) + return tools def _get_context(self, task: Task, task_outputs: List[TaskOutput]): context = ( diff --git a/src/crewai/llm.py b/src/crewai/llm.py index 1b0ac9b0a..5d6a0ccf5 100644 --- a/src/crewai/llm.py +++ b/src/crewai/llm.py @@ -64,6 +64,8 @@ LLM_CONTEXT_WINDOW_SIZES = { "llama3-70b-8192": 8192, "llama3-8b-8192": 8192, "mixtral-8x7b-32768": 32768, + "llama-3.3-70b-versatile": 128000, + "llama-3.3-70b-instruct": 128000, } DEFAULT_CONTEXT_WINDOW_SIZE = 8192 diff --git a/src/crewai/tools/agent_tools/add_image_tool.py b/src/crewai/tools/agent_tools/add_image_tool.py new file mode 100644 index 000000000..06bdfcf5b --- /dev/null +++ b/src/crewai/tools/agent_tools/add_image_tool.py @@ -0,0 +1,45 @@ +from typing import Dict, Optional, Union + +from pydantic import BaseModel, Field + +from crewai.tools.base_tool import BaseTool +from crewai.utilities import I18N + +i18n = I18N() + +class AddImageToolSchema(BaseModel): + image_url: str = Field(..., description="The URL or path of the image to add") + action: Optional[str] = Field( + default=None, + description="Optional context or question about the image" + ) + + +class AddImageTool(BaseTool): + """Tool for adding images to the content""" + + name: str = Field(default_factory=lambda: i18n.tools("add_image")["name"]) # type: ignore + description: str = Field(default_factory=lambda: i18n.tools("add_image")["description"]) # type: ignore + args_schema: type[BaseModel] = AddImageToolSchema + + def _run( + self, + image_url: str, + action: Optional[str] = None, + **kwargs, + ) -> dict: + action = action or i18n.tools("add_image")["default_action"] # type: ignore + content = [ + {"type": "text", "text": action}, + { + "type": "image_url", + "image_url": { + "url": image_url, + }, + } + ] + + return { + "role": "user", + "content": content + } diff --git a/src/crewai/tools/agent_tools/agent_tools.py b/src/crewai/tools/agent_tools/agent_tools.py index 08383c244..77d3c2d89 100644 --- a/src/crewai/tools/agent_tools/agent_tools.py +++ b/src/crewai/tools/agent_tools/agent_tools.py @@ -20,13 +20,13 @@ class AgentTools: delegate_tool = DelegateWorkTool( agents=self.agents, i18n=self.i18n, - description=self.i18n.tools("delegate_work").format(coworkers=coworkers), + description=self.i18n.tools("delegate_work").format(coworkers=coworkers), # type: ignore ) ask_tool = AskQuestionTool( agents=self.agents, i18n=self.i18n, - description=self.i18n.tools("ask_question").format(coworkers=coworkers), + description=self.i18n.tools("ask_question").format(coworkers=coworkers), # type: ignore ) return [delegate_tool, ask_tool] diff --git a/src/crewai/tools/tool_usage.py b/src/crewai/tools/tool_usage.py index 3de4a8fab..532587ced 100644 --- a/src/crewai/tools/tool_usage.py +++ b/src/crewai/tools/tool_usage.py @@ -10,6 +10,7 @@ from crewai.agents.tools_handler import ToolsHandler from crewai.task import Task from crewai.telemetry import Telemetry from crewai.tools import BaseTool +from crewai.tools.structured_tool import CrewStructuredTool from crewai.tools.tool_calling import InstructorToolCalling, ToolCalling from crewai.tools.tool_usage_events import ToolUsageError, ToolUsageFinished from crewai.utilities import I18N, Converter, ConverterError, Printer @@ -18,8 +19,7 @@ try: import agentops # type: ignore except ImportError: agentops = None - -OPENAI_BIGGER_MODELS = ["gpt-4", "gpt-4o", "o1-preview", "o1-mini"] +OPENAI_BIGGER_MODELS = ["gpt-4", "gpt-4o", "o1-preview", "o1-mini", "o1", "o3", "o3-mini"] class ToolUsageErrorException(Exception): @@ -103,6 +103,19 @@ class ToolUsage: if self.agent.verbose: self._printer.print(content=f"\n\n{error}\n", color="red") return error + + if isinstance(tool, CrewStructuredTool) and tool.name == self._i18n.tools("add_image")["name"]: # type: ignore + try: + result = self._use(tool_string=tool_string, tool=tool, calling=calling) + return result + + except Exception as e: + error = getattr(e, "message", str(e)) + self.task.increment_tools_errors() + if self.agent.verbose: + self._printer.print(content=f"\n\n{error}\n", color="red") + return error + return f"{self._use(tool_string=tool_string, tool=tool, calling=calling)}" # type: ignore # BUG?: "_use" of "ToolUsage" does not return a value (it only ever returns None) def _use( diff --git a/src/crewai/translations/en.json b/src/crewai/translations/en.json index 6bdbb7c29..12850c9e2 100644 --- a/src/crewai/translations/en.json +++ b/src/crewai/translations/en.json @@ -37,6 +37,11 @@ }, "tools": { "delegate_work": "Delegate a specific task to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the task you want them to do, and ALL necessary context to execute the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them.", - "ask_question": "Ask a specific question to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the question you have for them, and ALL necessary context to ask the question properly, they know nothing about the question, so share absolute everything you know, don't reference things but instead explain them." + "ask_question": "Ask a specific question to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the question you have for them, and ALL necessary context to ask the question properly, they know nothing about the question, so share absolute everything you know, don't reference things but instead explain them.", + "add_image": { + "name": "Add image to content", + "description": "See image to understand it's content, you can optionally ask a question about the image", + "default_action": "Please provide a detailed description of this image, including all visual elements, context, and any notable details you can observe." + } } } diff --git a/src/crewai/utilities/i18n.py b/src/crewai/utilities/i18n.py index e325834f3..ebf1abcda 100644 --- a/src/crewai/utilities/i18n.py +++ b/src/crewai/utilities/i18n.py @@ -1,6 +1,6 @@ import json import os -from typing import Dict, Optional +from typing import Dict, Optional, Union from pydantic import BaseModel, Field, PrivateAttr, model_validator @@ -41,8 +41,8 @@ class I18N(BaseModel): def errors(self, error: str) -> str: return self.retrieve("errors", error) - def tools(self, error: str) -> str: - return self.retrieve("tools", error) + def tools(self, tool: str) -> Union[str, Dict[str, str]]: + return self.retrieve("tools", tool) def retrieve(self, kind, key) -> str: try: diff --git a/tests/cassettes/test_crew_with_delegating_agents.yaml b/tests/cassettes/test_crew_with_delegating_agents.yaml index 651b821de..a6e074224 100644 --- a/tests/cassettes/test_crew_with_delegating_agents.yaml +++ b/tests/cassettes/test_crew_with_delegating_agents.yaml @@ -3,223 +3,17 @@ interactions: body: '{"messages": [{"role": "system", "content": "You are CEO. You''re an long time CEO of a content creation agency with a Senior Writer on the team. You''re now working on a new project and want to make sure the content produced is amazing.\nYour - personal goal is: Make sure the writers in your company produce amazing content.\nYou - ONLY have access to the following tools, and should NEVER make up tools that - are not listed here:\n\nTool Name: Delegate work to coworker(task: str, context: - str, coworker: Optional[str] = None, **kwargs)\nTool Description: Delegate a - specific task to one of the following coworkers: Senior Writer\nThe input to - this tool should be the coworker, the task you want them to do, and ALL necessary - context to execute the task, they know nothing about the task, so share absolute - everything you know, don''t reference things but instead explain them.\nTool - Arguments: {''task'': {''title'': ''Task'', ''type'': ''string''}, ''context'': - {''title'': ''Context'', ''type'': ''string''}, ''coworker'': {''title'': ''Coworker'', - ''type'': ''string''}, ''kwargs'': {''title'': ''Kwargs'', ''type'': ''object''}}\nTool - Name: Ask question to coworker(question: str, context: str, coworker: Optional[str] - = None, **kwargs)\nTool Description: Ask a specific question to one of the following - coworkers: Senior Writer\nThe input to this tool should be the coworker, the - question you have for them, and ALL necessary context to ask the question properly, - they know nothing about the question, so share absolute everything you know, - don''t reference things but instead explain them.\nTool Arguments: {''question'': - {''title'': ''Question'', ''type'': ''string''}, ''context'': {''title'': ''Context'', - ''type'': ''string''}, ''coworker'': {''title'': ''Coworker'', ''type'': ''string''}, - ''kwargs'': {''title'': ''Kwargs'', ''type'': ''object''}}\n\nUse the following - format:\n\nThought: you should always think about what to do\nAction: the action - to take, only one name of [Delegate work to coworker, Ask question to coworker], - just the name, exactly as it''s written.\nAction Input: the input to the action, - just a simple python dictionary, enclosed in curly braces, using \" to wrap - keys and values.\nObservation: the result of the action\n\nOnce all necessary - information is gathered:\n\nThought: I now know the final answer\nFinal Answer: - the final answer to the original input question\n"}, {"role": "user", "content": - "\nCurrent Task: Produce and amazing 1 paragraph draft of an article about AI - Agents.\n\nThis is the expect criteria for your final answer: A 4 paragraph - article about AI.\nyou MUST return the actual complete content as the final - answer, not a summary.\n\nBegin! This is VERY important to you, use the tools - available and give your best Final Answer, your job depends on it!\n\nThought:"}], - "model": "gpt-4o"}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '2762' - content-type: - - application/json - cookie: - - __cf_bm=9.8sBYBkvBR8R1K_bVF7xgU..80XKlEIg3N2OBbTSCU-1727214102-1.0.1.1-.qiTLXbPamYUMSuyNsOEB9jhGu.jOifujOrx9E2JZvStbIZ9RTIiE44xKKNfLPxQkOi6qAT3h6htK8lPDGV_5g; - _cfuvid=lbRdAddVWV6W3f5Dm9SaOPWDUOxqtZBSPr_fTW26nEA-1727213194587-0.0.1.1-604800000 - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.47.0 - x-stainless-arch: - - arm64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.47.0 - x-stainless-raw-response: - - 'true' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.11.7 - method: POST - uri: https://api.openai.com/v1/chat/completions - response: - content: "{\n \"id\": \"chatcmpl-AB7ZvxqgeOayGTQWwR61ASlZp0s74\",\n \"object\": - \"chat.completion\",\n \"created\": 1727214103,\n \"model\": \"gpt-4o-2024-05-13\",\n - \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": \"Thought: To ensure the content is amazing, - I'll delegate the task of producing a one-paragraph draft of an article about - AI Agents to the Senior Writer with all necessary context.\\n\\nAction: Delegate - work to coworker\\nAction Input: \\n{\\n \\\"coworker\\\": \\\"Senior Writer\\\", - \\n \\\"task\\\": \\\"Produce a one paragraph draft of an article about AI - Agents\\\", \\n \\\"context\\\": \\\"We need an amazing one-paragraph draft - as the beginning of a 4-paragraph article about AI Agents. This is for a high-stakes - project that critically impacts our company. The paragraph should highlight - what AI Agents are, their significance, and how they are transforming various - industries. The tone should be professional yet engaging. Make sure the content - is original, insightful, and thoroughly researched.\\\"\\n}\",\n \"refusal\": - null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n - \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 608,\n \"completion_tokens\": - 160,\n \"total_tokens\": 768,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_e375328146\"\n}\n" - headers: - CF-Cache-Status: - - DYNAMIC - CF-RAY: - - 8c85f0b038a71cf3-GRU - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Type: - - application/json - Date: - - Tue, 24 Sep 2024 21:41:45 GMT - Server: - - cloudflare - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - access-control-expose-headers: - - X-Request-ID - openai-organization: - - crewai-iuxna1 - openai-processing-ms: - - '1826' - openai-version: - - '2020-10-01' - strict-transport-security: - - max-age=31536000; includeSubDomains; preload - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '30000000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '29999325' - x-ratelimit-reset-requests: - - 6ms - x-ratelimit-reset-tokens: - - 1ms - x-request-id: - - req_79054638deeb01da76c5bba273bffc28 - http_version: HTTP/1.1 - status_code: 200 -- request: - body: !!binary | - Cq8OCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkShg4KEgoQY3Jld2FpLnRl - bGVtZXRyeRKQAgoQg15EMIBbDpydrcK3GAUYfBII5VYz5B10kmgqDlRhc2sgRXhlY3V0aW9uMAE5 - aGIpYwtM+BdBIO6VVRNM+BdKLgoIY3Jld19rZXkSIgogZTNmZGEwZjMxMTBmZTgwYjE4OTQ3YzAx - NDcxNDMwYTRKMQoHY3Jld19pZBImCiRjNzM1NzdhYi0xYThhLTQzMGYtYjYyZi01MTBlYWMyMWI3 - MThKLgoIdGFza19rZXkSIgogNWZhNjVjMDZhOWUzMWYyYzY5NTQzMjY2OGFjZDYyZGRKMQoHdGFz - a19pZBImCiQ3MjAzMjYyMC0yMzJmLTQ5ZTMtOGMyNy0xYzBlOWJhNjFiZDB6AhgBhQEAAQAAEssJ - ChB+du4H1wHcku5blhLQBtuoEgiXVguc5KA1RyoMQ3JldyBDcmVhdGVkMAE54IJsVxNM+BdBcCN4 - VxNM+BdKGgoOY3Jld2FpX3ZlcnNpb24SCAoGMC42MS4wShoKDnB5dGhvbl92ZXJzaW9uEggKBjMu - MTEuN0ouCghjcmV3X2tleRIiCiBlNjQ5NTczYTI2ZTU4Nzk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cmV0cnlfbGltaXQiOiAyLCAidG9vbHNfbmFtZXMiOiBbXX1dSvgB - CgpjcmV3X3Rhc2tzEukBCuYBW3sia2V5IjogIjBiOWQ2NWRiNmI3YWVkZmIzOThjNTllMmE5Zjcx - ZWM1IiwgImlkIjogImQ0YjVhZmE2LTczNTEtNDUxMy04NzY2LTIzOGNjYTk5ZjRlZiIsICJhc3lu - Y19leGVjdXRpb24/IjogZmFsc2UsICJodW1hbl9pbnB1dD8iOiBmYWxzZSwgImFnZW50X3JvbGUi - OiAiQ0VPIiwgImFnZW50X2tleSI6ICIzMjgyMTdiNmMyOTU5YmRmYzQ3Y2FkMDBlODQ4OTBkMCIs - ICJ0b29sc19uYW1lcyI6IFtdfV16AhgBhQEAAQAAEo4CChCLEGLGYlBkv0YucoYjY1NeEghRpGin - zpZUiSoMVGFzayBDcmVhdGVkMAE5KCA2WBNM+BdBaLw2WBNM+BdKLgoIY3Jld19rZXkSIgogZTY0 - OTU3M2EyNmU1ODc5MGNhYzIxYTM3Y2Q0NDQzN2FKMQoHY3Jld19pZBImCiQyOGU2NGJkNy1jZWFj - LTQ2MTktODJjNy0yMzZkZDU0MThjODdKLgoIdGFza19rZXkSIgogMGI5ZDY1ZGI2YjdhZWRmYjM5 - OGM1OWUyYTlmNzFlYzVKMQoHdGFza19pZBImCiRkNGI1YWZhNi03MzUxLTQ1MTMtODc2Ni0yMzhj - Y2E5OWY0ZWZ6AhgBhQEAAQAA - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '1842' - Content-Type: - - application/x-protobuf - User-Agent: - - OTel-OTLP-Exporter-Python/1.27.0 - method: POST - uri: https://telemetry.crewai.com:4319/v1/traces - response: - body: - string: "\n\0" - headers: - Content-Length: - - '2' - Content-Type: - - application/x-protobuf - Date: - - Tue, 24 Sep 2024 21:41:46 GMT - status: - code: 200 - message: OK -- request: - body: '{"messages": [{"role": "system", "content": "You are Senior Writer. You''re - a senior writer, specialized in technology, software engineering, AI and startups. - You work as a freelancer and are now working on writing content for a new customer.\nYour - personal goal is: Write the best content about AI and AI agents.\nTo give my - best complete final answer to the task use the exact following format:\n\nThought: + personal goal is: Make sure the writers in your company produce amazing content.\nTo + give my best complete final answer to the task use the exact following format:\n\nThought: I now can give a great answer\nFinal Answer: Your final answer must be the great and the most complete as possible, it must be outcome described.\n\nI MUST use these formats, my job depends on it!"}, {"role": "user", "content": "\nCurrent - Task: Produce a one paragraph draft of an article about AI Agents\n\nThis is - the expect criteria for your final answer: Your best answer to your coworker - asking you this, accounting for the context shared.\nyou MUST return the actual - complete content as the final answer, not a summary.\n\nThis is the context - you''re working with:\nWe need an amazing one-paragraph draft as the beginning - of a 4-paragraph article about AI Agents. This is for a high-stakes project - that critically impacts our company. The paragraph should highlight what AI - Agents are, their significance, and how they are transforming various industries. - The tone should be professional yet engaging. Make sure the content is original, - insightful, and thoroughly researched.\n\nBegin! This is VERY important to you, - use the tools available and give your best Final Answer, your job depends on - it!\n\nThought:"}], "model": "gpt-4o"}' + Task: Produce and amazing 1 paragraph draft of an article about AI Agents.\n\nThis + is the expect criteria for your final answer: A 4 paragraph article about AI.\nyou + MUST return the actual complete content as the final answer, not a summary.\n\nBegin! + This is VERY important to you, use the tools available and give your best Final + Answer, your job depends on it!\n\nThought:"}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"], "stream": false}' headers: accept: - application/json @@ -228,16 +22,13 @@ interactions: connection: - keep-alive content-length: - - '1545' + - '1105' content-type: - application/json - cookie: - - __cf_bm=9.8sBYBkvBR8R1K_bVF7xgU..80XKlEIg3N2OBbTSCU-1727214102-1.0.1.1-.qiTLXbPamYUMSuyNsOEB9jhGu.jOifujOrx9E2JZvStbIZ9RTIiE44xKKNfLPxQkOi6qAT3h6htK8lPDGV_5g; - _cfuvid=lbRdAddVWV6W3f5Dm9SaOPWDUOxqtZBSPr_fTW26nEA-1727213194587-0.0.1.1-604800000 host: - api.openai.com user-agent: - - OpenAI/Python 1.47.0 + - OpenAI/Python 1.52.1 x-stainless-arch: - arm64 x-stainless-async: @@ -247,9 +38,11 @@ interactions: x-stainless-os: - MacOS x-stainless-package-version: - - 1.47.0 + - 1.52.1 x-stainless-raw-response: - 'true' + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: @@ -257,31 +50,51 @@ interactions: method: POST uri: https://api.openai.com/v1/chat/completions response: - content: "{\n \"id\": \"chatcmpl-AB7ZxDYcPlSiBZsftdRs2cWbUJllW\",\n \"object\": - \"chat.completion\",\n \"created\": 1727214105,\n \"model\": \"gpt-4o-2024-05-13\",\n + content: "{\n \"id\": \"chatcmpl-Ahe7liUPejwfqxMe8aEWmKGJ837em\",\n \"object\": + \"chat.completion\",\n \"created\": 1734965705,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"I now can give a great answer \\nFinal - Answer: Artificial Intelligence (AI) Agents are sophisticated computer programs - designed to perform tasks that typically require human intelligence, such as - decision making, problem-solving, and learning. These agents operate autonomously, - utilizing vast amounts of data, advanced algorithms, and machine learning techniques - to analyze their environment, adapt to new information, and improve their performance - over time. The significance of AI Agents lies in their transformative potential - across various industries. In healthcare, they assist in diagnosing diseases - with greater accuracy; in finance, they predict market trends and manage risks; - in customer service, they provide personalized and efficient responses. As these - AI-powered entities continue to evolve, they are not only enhancing operational - efficiencies but also driving innovation and creating new opportunities for - growth and development in every sector they penetrate.\",\n \"refusal\": - null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n - \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 297,\n \"completion_tokens\": - 160,\n \"total_tokens\": 457,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_e375328146\"\n}\n" + Answer: In the rapidly evolving landscape of technology, AI agents have emerged + as formidable tools, revolutionizing how we interact with data and automate + tasks. These sophisticated systems leverage machine learning and natural language + processing to perform a myriad of functions, from virtual personal assistants + to complex decision-making companions in industries such as finance, healthcare, + and education. By mimicking human intelligence, AI agents can analyze massive + data sets at unparalleled speeds, enabling businesses to uncover valuable insights, + enhance productivity, and elevate user experiences to unprecedented levels.\\n\\nOne + of the most striking aspects of AI agents is their adaptability; they learn + from their interactions and continuously improve their performance over time. + This feature is particularly valuable in customer service where AI agents can + address inquiries, resolve issues, and provide personalized recommendations + without the limitations of human fatigue. Moreover, with intuitive interfaces, + AI agents enhance user interactions, making technology more accessible and user-friendly, + thereby breaking down barriers that have historically hindered digital engagement.\\n\\nDespite + their immense potential, the deployment of AI agents raises important ethical + and practical considerations. Issues related to privacy, data security, and + the potential for job displacement necessitate thoughtful dialogue and proactive + measures. Striking a balance between technological innovation and societal impact + will be crucial as organizations integrate these agents into their operations. + Additionally, ensuring transparency in AI decision-making processes is vital + to maintain public trust as AI agents become an integral part of daily life.\\n\\nLooking + ahead, the future of AI agents appears bright, with ongoing advancements promising + even greater capabilities. As we continue to harness the power of AI, we can + expect these agents to play a transformative role in shaping various sectors\u2014streamlining + workflows, enabling smarter decision-making, and fostering more personalized + experiences. Embracing this technology responsibly can lead to a future where + AI agents not only augment human effort but also inspire creativity and efficiency + across the board, ultimately redefining our interaction with the digital world.\",\n + \ \"refusal\": null\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 208,\n \"completion_tokens\": + 382,\n \"total_tokens\": 590,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_0aa8d3e20b\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8c85f0c0cf961cf3-GRU + - 8f6930c97a33ae54-GRU Connection: - keep-alive Content-Encoding: @@ -289,45 +102,77 @@ interactions: Content-Type: - application/json Date: - - Tue, 24 Sep 2024 21:41:48 GMT + - Mon, 23 Dec 2024 14:55:10 GMT Server: - cloudflare + Set-Cookie: + - __cf_bm=g58erGPkGAltcfYpDRU4IsdEEzb955dGmBOAZacFlPA-1734965710-1.0.1.1-IiodiX3uxbT5xSa4seI7M.gRM4Jj46h2d6ZW2wCkSUYUAX.ivRh_sGQN2hucEMzdG8O87pc00dCl7E5W8KkyEA; + path=/; expires=Mon, 23-Dec-24 15:25:10 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=eQzzWvIXDS8Me1OIBdCG5F1qFyVfAo3sumvYRE7J41E-1734965710778-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Transfer-Encoding: - chunked X-Content-Type-Options: - nosniff access-control-expose-headers: - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 openai-organization: - crewai-iuxna1 openai-processing-ms: - - '2468' + - '5401' openai-version: - '2020-10-01' strict-transport-security: - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - - '10000' + - '30000' x-ratelimit-limit-tokens: - - '30000000' + - '150000000' x-ratelimit-remaining-requests: - - '9999' + - '29999' x-ratelimit-remaining-tokens: - - '29999625' + - '149999746' x-ratelimit-reset-requests: - - 6ms + - 2ms x-ratelimit-reset-tokens: - 0s x-request-id: - - req_66c8801b42ac865249246d98225c1492 + - req_30791533923ae20626ef35a03ae66172 http_version: HTTP/1.1 status_code: 200 - request: body: !!binary | - CtwBCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSswEKEgoQY3Jld2FpLnRl - bGVtZXRyeRKcAQoQROg/k5NCUGdgfvfLrFlQDxIIlfh6oMbmqu0qClRvb2wgVXNhZ2UwATlws+Wj - FEz4F0EwBeijFEz4F0oaCg5jcmV3YWlfdmVyc2lvbhIICgYwLjYxLjBKKAoJdG9vbF9uYW1lEhsK - GURlbGVnY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NUoxCgd0YXNrX2lkEiYKJDc3ZjQ2NzA2 + LTc0Y2YtNGRlZC04ZTA1LTZkZWRjNDJmMGQ5YnoCGAGFAQABAAA= headers: Accept: - '*/*' @@ -336,7 +181,7 @@ interactions: Connection: - keep-alive Content-Length: - - '223' + - '1577' Content-Type: - application/x-protobuf User-Agent: @@ -352,213 +197,8 @@ interactions: Content-Type: - application/x-protobuf Date: - - Tue, 24 Sep 2024 21:41:51 GMT + - Mon, 23 Dec 2024 14:55:10 GMT status: code: 200 message: OK -- request: - body: '{"messages": [{"role": "system", "content": "You are CEO. You''re an long - time CEO of a content creation agency with a Senior Writer on the team. You''re - now working on a new project and want to make sure the content produced is amazing.\nYour - personal goal is: Make sure the writers in your company produce amazing content.\nYou - ONLY have access to the following tools, and should NEVER make up tools that - are not listed here:\n\nTool Name: Delegate work to coworker(task: str, context: - str, coworker: Optional[str] = None, **kwargs)\nTool Description: Delegate a - specific task to one of the following coworkers: Senior Writer\nThe input to - this tool should be the coworker, the task you want them to do, and ALL necessary - context to execute the task, they know nothing about the task, so share absolute - everything you know, don''t reference things but instead explain them.\nTool - Arguments: {''task'': {''title'': ''Task'', ''type'': ''string''}, ''context'': - {''title'': ''Context'', ''type'': ''string''}, ''coworker'': {''title'': ''Coworker'', - ''type'': ''string''}, ''kwargs'': {''title'': ''Kwargs'', ''type'': ''object''}}\nTool - Name: Ask question to coworker(question: str, context: str, coworker: Optional[str] - = None, **kwargs)\nTool Description: Ask a specific question to one of the following - coworkers: Senior Writer\nThe input to this tool should be the coworker, the - question you have for them, and ALL necessary context to ask the question properly, - they know nothing about the question, so share absolute everything you know, - don''t reference things but instead explain them.\nTool Arguments: {''question'': - {''title'': ''Question'', ''type'': ''string''}, ''context'': {''title'': ''Context'', - ''type'': ''string''}, ''coworker'': {''title'': ''Coworker'', ''type'': ''string''}, - ''kwargs'': {''title'': ''Kwargs'', ''type'': ''object''}}\n\nUse the following - format:\n\nThought: you should always think about what to do\nAction: the action - to take, only one name of [Delegate work to coworker, Ask question to coworker], - just the name, exactly as it''s written.\nAction Input: the input to the action, - just a simple python dictionary, enclosed in curly braces, using \" to wrap - keys and values.\nObservation: the result of the action\n\nOnce all necessary - information is gathered:\n\nThought: I now know the final answer\nFinal Answer: - the final answer to the original input question\n"}, {"role": "user", "content": - "\nCurrent Task: Produce and amazing 1 paragraph draft of an article about AI - Agents.\n\nThis is the expect criteria for your final answer: A 4 paragraph - article about AI.\nyou MUST return the actual complete content as the final - answer, not a summary.\n\nBegin! This is VERY important to you, use the tools - available and give your best Final Answer, your job depends on it!\n\nThought:"}, - {"role": "assistant", "content": "Thought: To ensure the content is amazing, - I''ll delegate the task of producing a one-paragraph draft of an article about - AI Agents to the Senior Writer with all necessary context.\n\nAction: Delegate - work to coworker\nAction Input: \n{\n \"coworker\": \"Senior Writer\", \n \"task\": - \"Produce a one paragraph draft of an article about AI Agents\", \n \"context\": - \"We need an amazing one-paragraph draft as the beginning of a 4-paragraph article - about AI Agents. This is for a high-stakes project that critically impacts our - company. The paragraph should highlight what AI Agents are, their significance, - and how they are transforming various industries. The tone should be professional - yet engaging. Make sure the content is original, insightful, and thoroughly - researched.\"\n}\nObservation: Artificial Intelligence (AI) Agents are sophisticated - computer programs designed to perform tasks that typically require human intelligence, - such as decision making, problem-solving, and learning. These agents operate - autonomously, utilizing vast amounts of data, advanced algorithms, and machine - learning techniques to analyze their environment, adapt to new information, - and improve their performance over time. The significance of AI Agents lies - in their transformative potential across various industries. In healthcare, - they assist in diagnosing diseases with greater accuracy; in finance, they predict - market trends and manage risks; in customer service, they provide personalized - and efficient responses. As these AI-powered entities continue to evolve, they - are not only enhancing operational efficiencies but also driving innovation - and creating new opportunities for growth and development in every sector they - penetrate."}], "model": "gpt-4o"}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '4536' - content-type: - - application/json - cookie: - - __cf_bm=9.8sBYBkvBR8R1K_bVF7xgU..80XKlEIg3N2OBbTSCU-1727214102-1.0.1.1-.qiTLXbPamYUMSuyNsOEB9jhGu.jOifujOrx9E2JZvStbIZ9RTIiE44xKKNfLPxQkOi6qAT3h6htK8lPDGV_5g; - _cfuvid=lbRdAddVWV6W3f5Dm9SaOPWDUOxqtZBSPr_fTW26nEA-1727213194587-0.0.1.1-604800000 - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.47.0 - x-stainless-arch: - - arm64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.47.0 - x-stainless-raw-response: - - 'true' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.11.7 - method: POST - uri: https://api.openai.com/v1/chat/completions - response: - content: "{\n \"id\": \"chatcmpl-AB7a1PO3pMNybn76wXDFc5HE7ZRsL\",\n \"object\": - \"chat.completion\",\n \"created\": 1727214109,\n \"model\": \"gpt-4o-2024-05-13\",\n - \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": \"Thought: The paragraph provided by the - Senior Writer is well-detailed and engaging. I will now structure the 4-paragraph - article around this draft, adding an introduction, expanding on the specific - applications in various industries, and concluding with the potential future - impact of AI Agents.\\n\\nFinal Answer:\\n\\nArtificial Intelligence (AI) Agents - are sophisticated computer programs designed to perform tasks that typically - require human intelligence, such as decision making, problem-solving, and learning. - These agents operate autonomously, utilizing vast amounts of data, advanced - algorithms, and machine learning techniques to analyze their environment, adapt - to new information, and improve their performance over time.\\n\\nThe significance - of AI Agents lies in their transformative potential across various industries. - In healthcare, for example, they assist in diagnosing diseases with greater - accuracy and speed than human practitioners, offering personalized treatment - plans by analyzing patient data. In finance, AI Agents predict market trends, - manage risks, and even execute trades, contributing to more stable and profitable - financial systems. Customer service sectors benefit significantly from AI Agents, - as they provide personalized and efficient responses, often resolving issues - faster than traditional methods.\\n\\nMoreover, AI Agents are also making substantial - contributions in fields like education and manufacturing. In education, they - offer tailored learning experiences by assessing individual student needs and - adjusting teaching methods accordingly. They help educators identify students - who might need additional support and provide resources to enhance learning - outcomes. In manufacturing, AI Agents optimize production lines, predict equipment - failures, and improve supply chain management, thus boosting productivity and - reducing downtime.\\n\\nAs these AI-powered entities continue to evolve, they - are not only enhancing operational efficiencies but also driving innovation - and creating new opportunities for growth and development in every sector they - penetrate. The future of AI Agents looks promising, with the potential to revolutionize - the way we live and work, making processes more efficient, decisions more data-driven, - and solutions more innovative than ever before.\\n\\nThis is now a well-rounded, - four-paragraph article that comprehensively covers the topic of AI Agents.\\n\\nFinal - Answer: This is the complete content as specified:\\nArtificial Intelligence - (AI) Agents are sophisticated computer programs designed to perform tasks that - typically require human intelligence, such as decision making, problem-solving, - and learning. These agents operate autonomously, utilizing vast amounts of data, - advanced algorithms, and machine learning techniques to analyze their environment, - adapt to new information, and improve their performance over time.\\n\\nThe - significance of AI Agents lies in their transformative potential across various - industries. In healthcare, for example, they assist in diagnosing diseases with - greater accuracy and speed than human practitioners, offering personalized treatment - plans by analyzing patient data. In finance, AI Agents predict market trends, - manage risks, and even execute trades, contributing to more stable and profitable - financial systems. Customer service sectors benefit significantly from AI Agents, - as they provide personalized and efficient responses, often resolving issues - faster than traditional methods.\\n\\nMoreover, AI Agents are also making substantial - contributions in fields like education and manufacturing. In education, they - offer tailored learning experiences by assessing individual student needs and - adjusting teaching methods accordingly. They help educators identify students - who might need additional support and provide resources to enhance learning - outcomes. In manufacturing, AI Agents optimize production lines, predict equipment - failures, and improve supply chain management, thus boosting productivity and - reducing downtime.\\n\\nAs these AI-powered entities continue to evolve, they - are not only enhancing operational efficiencies but also driving innovation - and creating new opportunities for growth and development in every sector they - penetrate. The future of AI Agents looks promising, with the potential to revolutionize - the way we live and work, making processes more efficient, decisions more data-driven, - and solutions more innovative than ever before.\",\n \"refusal\": null\n - \ },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n - \ ],\n \"usage\": {\n \"prompt_tokens\": 923,\n \"completion_tokens\": - 715,\n \"total_tokens\": 1638,\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0\n }\n },\n \"system_fingerprint\": \"fp_e375328146\"\n}\n" - headers: - CF-Cache-Status: - - DYNAMIC - CF-RAY: - - 8c85f0d2f90c1cf3-GRU - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Type: - - application/json - Date: - - Tue, 24 Sep 2024 21:41:58 GMT - Server: - - cloudflare - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - access-control-expose-headers: - - X-Request-ID - openai-organization: - - crewai-iuxna1 - openai-processing-ms: - - '8591' - openai-version: - - '2020-10-01' - strict-transport-security: - - max-age=31536000; includeSubDomains; preload - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '30000000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '29998895' - x-ratelimit-reset-requests: - - 6ms - x-ratelimit-reset-tokens: - - 2ms - x-request-id: - - req_2b51b5cff02148d29b04284b40ca6081 - http_version: HTTP/1.1 - status_code: 200 version: 1 diff --git a/tests/cassettes/test_crew_with_delegating_agents_should_not_override_agent_tools.yaml b/tests/cassettes/test_crew_with_delegating_agents_should_not_override_agent_tools.yaml new file mode 100644 index 000000000..93191bb6f --- /dev/null +++ b/tests/cassettes/test_crew_with_delegating_agents_should_not_override_agent_tools.yaml @@ -0,0 +1,480 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are CEO. You''re an long + time CEO of a content creation agency with a Senior Writer on the team. You''re + now working on a new project and want to make sure the content produced is amazing.\nYour + personal goal is: Make sure the writers in your company produce amazing content.\nYou + ONLY have access to the following tools, and should NEVER make up tools that + are not listed here:\n\nTool Name: Test Tool\nTool Arguments: {''query'': {''description'': + ''Query to process'', ''type'': ''str''}}\nTool Description: A test tool that + just returns the input\n\nUse the following format:\n\nThought: you should always + think about what to do\nAction: the action to take, only one name of [Test Tool], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple python dictionary, enclosed in curly braces, using \" to wrap + keys and values.\nObservation: the result of the action\n\nOnce all necessary + information is gathered:\n\nThought: I now know the final answer\nFinal Answer: + the final answer to the original input question"}, {"role": "user", "content": + "\nCurrent Task: Produce and amazing 1 paragraph draft of an article about AI + Agents.\n\nThis is the expect criteria for your final answer: A 4 paragraph + article about AI.\nyou MUST return the actual complete content as the final + answer, not a summary.\n\nBegin! This is VERY important to you, use the tools + available and give your best Final Answer, your job depends on it!\n\nThought:"}], + "model": "gpt-4o-mini", "stop": ["\nObservation:"], "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1581' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AhLsKP8xKkISk8ntUscyUKL30xRXW\",\n \"object\": + \"chat.completion\",\n \"created\": 1734895556,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"I need to gather information to create + an amazing paragraph draft about AI Agents that aligns with the expected criteria + of a 4-paragraph article about AI. \\n\\nAction: Test Tool \\nAction Input: + {\\\"query\\\": \\\"Write a captivating and informative paragraph about AI Agents, + focusing on their capabilities, applications, and significance in modern technology.\\\"} + \ \",\n \"refusal\": null\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 309,\n \"completion_tokens\": + 68,\n \"total_tokens\": 377,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_0aa8d3e20b\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f62802d0b3f00d5-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 22 Dec 2024 19:25:57 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=vwBNilrHRgMLd8ALWzYrBO5Lm8ieJzbQ3WCVOgmuJ.s-1734895557-1.0.1.1-z.QnDsynL_Ndu.JkWrh_wGMo57vvpK88nWDBTA8P.6prlSRmA91GQLpP62yRUbCW6yoKFbDxroSaYO6qrzZPRg; + path=/; expires=Sun, 22-Dec-24 19:55:57 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=2u_Xw.i716TDjD2vb2mvMyWxhA4q1MM1JvbrA8CNZpI-1734895557894-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1075' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999630' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_80fbcef3505afac708a24ef167b701bb + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are CEO. You''re an long + time CEO of a content creation agency with a Senior Writer on the team. You''re + now working on a new project and want to make sure the content produced is amazing.\nYour + personal goal is: Make sure the writers in your company produce amazing content.\nYou + ONLY have access to the following tools, and should NEVER make up tools that + are not listed here:\n\nTool Name: Test Tool\nTool Arguments: {''query'': {''description'': + ''Query to process'', ''type'': ''str''}}\nTool Description: A test tool that + just returns the input\n\nUse the following format:\n\nThought: you should always + think about what to do\nAction: the action to take, only one name of [Test Tool], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple python dictionary, enclosed in curly braces, using \" to wrap + keys and values.\nObservation: the result of the action\n\nOnce all necessary + information is gathered:\n\nThought: I now know the final answer\nFinal Answer: + the final answer to the original input question"}, {"role": "user", "content": + "\nCurrent Task: Produce and amazing 1 paragraph draft of an article about AI + Agents.\n\nThis is the expect criteria for your final answer: A 4 paragraph + article about AI.\nyou MUST return the actual complete content as the final + answer, not a summary.\n\nBegin! This is VERY important to you, use the tools + available and give your best Final Answer, your job depends on it!\n\nThought:"}, + {"role": "assistant", "content": "I need to gather information to create an + amazing paragraph draft about AI Agents that aligns with the expected criteria + of a 4-paragraph article about AI. \n\nAction: Test Tool \nAction Input: {\"query\": + \"Write a captivating and informative paragraph about AI Agents, focusing on + their capabilities, applications, and significance in modern technology.\"} \nObservation: + Processed: Write a captivating and informative paragraph about AI Agents, focusing + on their capabilities, applications, and significance in modern technology."}], + "model": "gpt-4o-mini", "stop": ["\nObservation:"], "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '2153' + content-type: + - application/json + cookie: + - __cf_bm=vwBNilrHRgMLd8ALWzYrBO5Lm8ieJzbQ3WCVOgmuJ.s-1734895557-1.0.1.1-z.QnDsynL_Ndu.JkWrh_wGMo57vvpK88nWDBTA8P.6prlSRmA91GQLpP62yRUbCW6yoKFbDxroSaYO6qrzZPRg; + _cfuvid=2u_Xw.i716TDjD2vb2mvMyWxhA4q1MM1JvbrA8CNZpI-1734895557894-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AhLsMt1AgrzynC2TSJZZSwr9El8FV\",\n \"object\": + \"chat.completion\",\n \"created\": 1734895558,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"Thought: I have received the content + related to AI Agents, which I need to now use as a foundation for creating a + complete 4-paragraph article about AI. \\n\\nAction: Test Tool \\nAction Input: + {\\\"query\\\": \\\"Based on the previous paragraph about AI Agents, write a + 4-paragraph article about AI, including an introduction, discussion of AI Agents, + their applications, and a conclusion on the future of AI.\\\"} \",\n \"refusal\": + null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 409,\n \"completion_tokens\": + 88,\n \"total_tokens\": 497,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_0aa8d3e20b\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f6280352b9400d5-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 22 Dec 2024 19:25:59 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1346' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999498' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_e25b377af34ef03b9a6955c9cfca5738 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + CtoOCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSsQ4KEgoQY3Jld2FpLnRl + bGVtZXRyeRLrCQoQHzrcBLmZm6+CB9ZGtTnz1BIISnyRX3cExT4qDENyZXcgQ3JlYXRlZDABOdCK + UxFRlhMYQdiyWhFRlhMYShoKDmNyZXdhaV92ZXJzaW9uEggKBjAuODYuMEoaCg5weXRob25fdmVy + c2lvbhIICgYzLjExLjdKLgoIY3Jld19rZXkSIgogZTY0OTU3M2EyNmU1ODc5MGNhYzIxYTM3Y2Q0 + NDQzN2FKMQoHY3Jld19pZBImCiQyYWFjYzYwZC0xYzE5LTRjZGYtYmJhNy1iM2RiMGM4YzFlZWZK + HAoMY3Jld19wcm9jZXNzEgwKCnNlcXVlbnRpYWxKEQoLY3Jld19tZW1vcnkSAhAAShoKFGNyZXdf + bnVtYmVyX29mX3Rhc2tzEgIYAUobChVjcmV3X251bWJlcl9vZl9hZ2VudHMSAhgCSpUFCgtjcmV3 + X2FnZW50cxKFBQqCBVt7ImtleSI6ICIzMjgyMTdiNmMyOTU5YmRmYzQ3Y2FkMDBlODQ4OTBkMCIs + ICJpZCI6ICJlZmE4ZWRlNS0wN2IyLTQzOWUtYWQ4Yi1iNmQ0Nzg5NjBkNzkiLCAicm9sZSI6ICJD + RU8iLCAidmVyYm9zZT8iOiBmYWxzZSwgIm1heF9pdGVyIjogMjAsICJtYXhfcnBtIjogbnVsbCwg + ImZ1bmN0aW9uX2NhbGxpbmdfbGxtIjogIiIsICJsbG0iOiAiZ3B0LTRvLW1pbmkiLCAiZGVsZWdh + dGlvbl9lbmFibGVkPyI6IHRyd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0NDQzN2FKMQoHY3Jld19pZBImCiQyYWFjYzYwZC0xYzE5LTRjZGYtYmJhNy1iM2Ri + MGM4YzFlZWZKLgoIdGFza19rZXkSIgogMGI5ZDY1ZGI2YjdhZWRmYjM5OGM1OWUyYTlmNzFlYzVK + MQoHdGFza19pZBImCiRiNjYyZWVkOS1kYzcyLTQ1NTEtYTdmMC1kY2E4ZTk3MmU3Njd6AhgBhQEA + AQAAEowBChDS1rm7Q+c0w96t+encwsGJEgjRF+jTQh1PCyoKVG9vbCBVc2FnZTABOaAiFGtRlhMY + QdiVImtRlhMYShoKDmNyZXdhaV92ZXJzaW9uEggKBjAuODYuMEoYCgl0b29sX25hbWUSCwoJVGVz + dCBUb29sSg4KCGF0dGVtcHRzEgIYAXoCGAGFAQABAAASjAEKECYGxNLnTRLCS76uAAOuzGwSCPmX + kSTjWKCcKgpUb29sIFVzYWdlMAE5CH3Wx1GWExhBGH/xx1GWExhKGgoOY3Jld2FpX3ZlcnNpb24S + CAoGMC44Ni4wShgKCXRvb2xfbmFtZRILCglUZXN0IFRvb2xKDgoIYXR0ZW1wdHMSAhgBegIYAYUB + AAEAAA== + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1885' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.27.0 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Sun, 22 Dec 2024 19:26:01 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are CEO. You''re an long + time CEO of a content creation agency with a Senior Writer on the team. You''re + now working on a new project and want to make sure the content produced is amazing.\nYour + personal goal is: Make sure the writers in your company produce amazing content.\nYou + ONLY have access to the following tools, and should NEVER make up tools that + are not listed here:\n\nTool Name: Test Tool\nTool Arguments: {''query'': {''description'': + ''Query to process'', ''type'': ''str''}}\nTool Description: A test tool that + just returns the input\n\nUse the following format:\n\nThought: you should always + think about what to do\nAction: the action to take, only one name of [Test Tool], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple python dictionary, enclosed in curly braces, using \" to wrap + keys and values.\nObservation: the result of the action\n\nOnce all necessary + information is gathered:\n\nThought: I now know the final answer\nFinal Answer: + the final answer to the original input question"}, {"role": "user", "content": + "\nCurrent Task: Produce and amazing 1 paragraph draft of an article about AI + Agents.\n\nThis is the expect criteria for your final answer: A 4 paragraph + article about AI.\nyou MUST return the actual complete content as the final + answer, not a summary.\n\nBegin! This is VERY important to you, use the tools + available and give your best Final Answer, your job depends on it!\n\nThought:"}, + {"role": "assistant", "content": "I need to gather information to create an + amazing paragraph draft about AI Agents that aligns with the expected criteria + of a 4-paragraph article about AI. \n\nAction: Test Tool \nAction Input: {\"query\": + \"Write a captivating and informative paragraph about AI Agents, focusing on + their capabilities, applications, and significance in modern technology.\"} \nObservation: + Processed: Write a captivating and informative paragraph about AI Agents, focusing + on their capabilities, applications, and significance in modern technology."}, + {"role": "assistant", "content": "Thought: I have received the content related + to AI Agents, which I need to now use as a foundation for creating a complete + 4-paragraph article about AI. \n\nAction: Test Tool \nAction Input: {\"query\": + \"Based on the previous paragraph about AI Agents, write a 4-paragraph article + about AI, including an introduction, discussion of AI Agents, their applications, + and a conclusion on the future of AI.\"} \nObservation: Processed: Based on + the previous paragraph about AI Agents, write a 4-paragraph article about AI, + including an introduction, discussion of AI Agents, their applications, and + a conclusion on the future of AI."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"], + "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '2820' + content-type: + - application/json + cookie: + - __cf_bm=vwBNilrHRgMLd8ALWzYrBO5Lm8ieJzbQ3WCVOgmuJ.s-1734895557-1.0.1.1-z.QnDsynL_Ndu.JkWrh_wGMo57vvpK88nWDBTA8P.6prlSRmA91GQLpP62yRUbCW6yoKFbDxroSaYO6qrzZPRg; + _cfuvid=2u_Xw.i716TDjD2vb2mvMyWxhA4q1MM1JvbrA8CNZpI-1734895557894-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AhLsNJa6GxRIHF8l8eViU7D6CyBHP\",\n \"object\": + \"chat.completion\",\n \"created\": 1734895559,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"Thought: I have gathered the complete + article on AI, which aligns with the expected criteria. Now I will present the + final answer as required. \\n\\nFinal Answer: \\n\\nArtificial Intelligence + (AI) has rapidly evolved to become an integral part of our modern world, driving + significant advancements across various industries. AI refers to the simulation + of human intelligence in machines programmed to think and learn like humans. + This technology enables machines to analyze data, recognize patterns, and make + decisions with minimal human intervention, paving the way for innovation in + fields like healthcare, finance, and transportation.\\n\\nAI Agents, in particular, + embody the future of artificial intelligence by acting autonomously to perform + complex tasks. These agents leverage machine learning and natural language processing + to interact with users and understand their needs. They're deployed in customer + service applications, virtual assistants, and personal scheduling tools, showcasing + their capability to streamline processes and enhance user experience. By mimicking + human reasoning, AI Agents can adapt to changing situations and provide personalized + solutions.\\n\\nThe applications of AI Agents extend beyond mere task completion; + they are transforming the way businesses operate. In the realm of customer engagement, + AI Agents analyze customer behavior to provide insights that help companies + tailor their offerings. In healthcare, they assist in diagnosing illnesses by + analyzing patient data and suggesting treatments. The versatility of AI Agents + makes them invaluable assets in our increasingly automated world.\\n\\nAs we + look to the future, the potential of AI continues to expand. With ongoing advancements + in technology, AI Agents are set to become even more sophisticated, further + bridging the gap between humans and machines. The prospects of AI promise not + only to improve efficiency and productivity but also to change the way we live + and work, promising a future where intelligent, autonomous agents support us + in our daily lives.\",\n \"refusal\": null\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 546,\n \"completion_tokens\": 343,\n \"total_tokens\": 889,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_0aa8d3e20b\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f62803eed8100d5-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 22 Dec 2024 19:26:04 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '4897' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999342' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_65fdf94aa8bbc10f64f2a27ccdcc5cc8 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/cassettes/test_crew_with_delegating_agents_should_not_override_task_tools.yaml b/tests/cassettes/test_crew_with_delegating_agents_should_not_override_task_tools.yaml new file mode 100644 index 000000000..ee95ca796 --- /dev/null +++ b/tests/cassettes/test_crew_with_delegating_agents_should_not_override_task_tools.yaml @@ -0,0 +1,623 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are CEO. You''re an long + time CEO of a content creation agency with a Senior Writer on the team. You''re + now working on a new project and want to make sure the content produced is amazing.\nYour + personal goal is: Make sure the writers in your company produce amazing content.\nYou + ONLY have access to the following tools, and should NEVER make up tools that + are not listed here:\n\nTool Name: Test Tool\nTool Arguments: {''query'': {''description'': + ''Query to process'', ''type'': ''str''}}\nTool Description: A test tool that + just returns the input\nTool Name: Delegate work to coworker\nTool Arguments: + {''task'': {''description'': ''The task to delegate'', ''type'': ''str''}, ''context'': + {''description'': ''The context for the task'', ''type'': ''str''}, ''coworker'': + {''description'': ''The role/name of the coworker to delegate to'', ''type'': + ''str''}}\nTool Description: Delegate a specific task to one of the following + coworkers: Senior Writer\nThe input to this tool should be the coworker, the + task you want them to do, and ALL necessary context to execute the task, they + know nothing about the task, so share absolute everything you know, don''t reference + things but instead explain them.\nTool Name: Ask question to coworker\nTool + Arguments: {''question'': {''description'': ''The question to ask'', ''type'': + ''str''}, ''context'': {''description'': ''The context for the question'', ''type'': + ''str''}, ''coworker'': {''description'': ''The role/name of the coworker to + ask'', ''type'': ''str''}}\nTool Description: Ask a specific question to one + of the following coworkers: Senior Writer\nThe input to this tool should be + the coworker, the question you have for them, and ALL necessary context to ask + the question properly, they know nothing about the question, so share absolute + everything you know, don''t reference things but instead explain them.\n\nUse + the following format:\n\nThought: you should always think about what to do\nAction: + the action to take, only one name of [Test Tool, Delegate work to coworker, + Ask question to coworker], just the name, exactly as it''s written.\nAction + Input: the input to the action, just a simple python dictionary, enclosed in + curly braces, using \" to wrap keys and values.\nObservation: the result of + the action\n\nOnce all necessary information is gathered:\n\nThought: I now + know the final answer\nFinal Answer: the final answer to the original input + question"}, {"role": "user", "content": "\nCurrent Task: Produce and amazing + 1 paragraph draft of an article about AI Agents.\n\nThis is the expect criteria + for your final answer: A 4 paragraph article about AI.\nyou MUST return the + actual complete content as the final answer, not a summary.\n\nBegin! This is + VERY important to you, use the tools available and give your best Final Answer, + your job depends on it!\n\nThought:"}], "model": "gpt-4o-mini", "stop": ["\nObservation:"], + "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '2892' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AhLQELAjJpn76wiLmWBinm3sqf32l\",\n \"object\": + \"chat.completion\",\n \"created\": 1734893814,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"I need to gather information and insights + to ensure the Senior Writer produces a high-quality draft about AI Agents, which + will then serve as a foundation for the complete article.\\n\\nAction: Ask question + to coworker \\nAction Input: {\\\"question\\\":\\\"Can you provide a detailed + overview of what AI Agents are, their functionalities, and their applications + in real-world scenarios? Please include examples of how they are being used + in various industries, and discuss their potential impact on the future of technology + and society.\\\",\\\"context\\\":\\\"We are looking to create a comprehensive + understanding of AI Agents as part of a four-paragraph article. This will help + generate a high-quality draft for the article.\\\",\\\"coworker\\\":\\\"Senior + Writer\\\"} \",\n \"refusal\": null\n },\n \"logprobs\": null,\n + \ \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 604,\n \"completion_tokens\": 138,\n \"total_tokens\": 742,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_0aa8d3e20b\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f6255a1bf08a519-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 22 Dec 2024 18:56:56 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=rVquIlcnYXc7wMkbKG5Ii90HxfQ_ukNJjDgSHhsWb1k-1734893816-1.0.1.1-33qDl8KNWcxLAGBuPhT8FrZ6QUnEy9oOYh2Fp2hIjDnF.cQlyrgxiWcuHljTTxG_mH7eQrf1AHJ6p8sxZJZ30A; + path=/; expires=Sun, 22-Dec-24 19:26:56 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=xqgLJsf3h5lBKZFTADRNNUqizeChNBBFoLvWiR2WPnw-1734893816555-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '2340' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999305' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_53956b48bd1188451efc104e8a234ef4 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + CrEMCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSiAwKEgoQY3Jld2FpLnRl + bGVtZXRyeRLgCQoQg/HA64g3phKbzz/hvUtbahIIpu+Csq+uWc0qDENyZXcgQ3JlYXRlZDABOSDm + Uli7lBMYQcgRXFi7lBMYShoKDmNyZXdhaV92ZXJzaW9uEggKBjAuODYuM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aSIsICJkZWxlZ2F0aW9uX2VuYWJsZWQ/IjogZmFsc2Us + ICJhbGxvd19jb2RlX2V4ZWN1dGlvbj8iOiBmYWxzZSwgIm1heF9yZXRyeV9saW1pdCI6IDIsICJ0 + b29sc19uYW1lcyI6IFtdfV1KgwIKCmNyZXdfdGFza3MS9AEK8QFbeyJrZXkiOiAiMGI5ZDY1ZGI2 + YjdhZWRmYjM5OGM1OWUyYTlmNzFlYzUiLCAiaWQiOiAiY2IyMmIxMzctZTA3ZC00NDA5LWI5NmMt + ZWQ2ZDU3MjFhNDNiIiwgImFzeW5jX2V4ZWN1dGlvbj8iOiBmYWxzZSwgImh1bWFuX2lucHV0PyI6 + IGZhbHNlLCAiYWdlbnRfcm9sZSI6ICJDRU8iLCAiYWdlbnRfa2V5IjogIjMyODIxN2I2YzI5NTli + ZGZjNDdjYWQwMGU4NDg5MGQwIiwgInRvb2xzX25hbWVzIjogWyJ0ZXN0IHRvb2wiXX1degIYAYUB + AAEAABKOAgoQB7Z9AEDI9OTStHqguBSbLxIIj9dttVFJs9cqDFRhc2sgQ3JlYXRlZDABOYDae1i7 + lBMYQeBHfFi7lBMYSi4KCGNyZXdfa2V5EiIKIGU2NDk1NzNhMjZlNTg3OTBjYWMyMWEzN2NkNDQ0 + MzdhSjEKB2NyZXdfaWQSJgokYTFhYzE3NDctMTEwNC00ZWYyLTg2ZDYtNmRkYTUxZjA5ZjE3Si4K + CHRhc2tfa2V5EiIKIDBiOWQ2NWRiNmI3YWVkZmIzOThjNTllMmE5ZjcxZWM1SjEKB3Rhc2tfaWQS + JgokY2IyMmIxMzctZTA3ZC00NDA5LWI5NmMtZWQ2ZDU3MjFhNDNiegIYAYUBAAEAAA== + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1588' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.27.0 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Sun, 22 Dec 2024 18:56:59 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are Senior Writer. You''re + a senior writer, specialized in technology, software engineering, AI and startups. + You work as a freelancer and are now working on writing content for a new customer.\nYour + personal goal is: Write the best content about AI and AI agents.\nTo give my + best complete final answer to the task use the exact following format:\n\nThought: + I now can give a great answer\nFinal Answer: Your final answer must be the great + and the most complete as possible, it must be outcome described.\n\nI MUST use + these formats, my job depends on it!"}, {"role": "user", "content": "\nCurrent + Task: Can you provide a detailed overview of what AI Agents are, their functionalities, + and their applications in real-world scenarios? Please include examples of how + they are being used in various industries, and discuss their potential impact + on the future of technology and society.\n\nThis is the expect criteria for + your final answer: Your best answer to your coworker asking you this, accounting + for the context shared.\nyou MUST return the actual complete content as the + final answer, not a summary.\n\nThis is the context you''re working with:\nWe + are looking to create a comprehensive understanding of AI Agents as part of + a four-paragraph article. This will help generate a high-quality draft for the + article.\n\nBegin! This is VERY important to you, use the tools available and + give your best Final Answer, your job depends on it!\n\nThought:"}], "model": + "gpt-4o-mini", "stop": ["\nObservation:"], "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1572' + content-type: + - application/json + cookie: + - __cf_bm=rVquIlcnYXc7wMkbKG5Ii90HxfQ_ukNJjDgSHhsWb1k-1734893816-1.0.1.1-33qDl8KNWcxLAGBuPhT8FrZ6QUnEy9oOYh2Fp2hIjDnF.cQlyrgxiWcuHljTTxG_mH7eQrf1AHJ6p8sxZJZ30A; + _cfuvid=xqgLJsf3h5lBKZFTADRNNUqizeChNBBFoLvWiR2WPnw-1734893816555-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AhLQG5ubl99yeBYm6TTV0sodagMND\",\n \"object\": + \"chat.completion\",\n \"created\": 1734893816,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"I now can give a great answer \\nFinal + Answer: \\n\\n**Overview of AI Agents** \\nAI agents are advanced software + systems designed to autonomously perform tasks, make decisions, and learn from + their environments without needing constant human intervention. They leverage + machine learning, natural language processing, and various AI techniques to + simulate human-like understanding and autonomy. These agents can be categorized + into three types: reactive agents (which operate purely based on their environment), + deliberative agents (which can make decisions based on reasoning), and hybrid + agents that incorporate aspects of both types. Their ability to adapt and learn + over time makes them instrumental in automating processes across various domains.\\n\\n**Functionalities + of AI Agents** \\nThe core functionalities of AI agents include perception, + action, learning, and interaction. They perceive data through sensors or data + feeds, process information through algorithms, and take actions based on this + data. Machine learning allows them to refine their performance over time by + analyzing outcomes and adjusting their strategies accordingly. Interaction capabilities + enable them to communicate with users, providing insights, answering queries, + or even negotiating in some cases. These functionalities make AI agents invaluable + for tasks such as predictive analytics, personal assistance, and real-time decision-making + in complex systems.\\n\\n**Applications in Various Industries** \\nAI agents + are already being utilized across multiple industries, demonstrating their versatility + and efficiency. In healthcare, AI agents assist in diagnostics by analyzing + medical records and suggesting treatment plans tailored to individual patients. + In finance, they power robo-advisors that manage investment portfolios, automate + trading strategies, and provide financial advice based on real-time market analysis. + Furthermore, in customer service, AI chatbots serve as virtual assistants, enhancing + user experience by providing instant support and resolving queries without human + intervention. The logistics and supply chain industries have also seen AI agents + optimize inventory management and route planning, significantly improving operational + efficiency.\\n\\n**Future Impact on Technology and Society** \\nThe ongoing + development of AI agents is poised to have a profound impact on technology and + society. As these agents become more sophisticated, we can anticipate a shift + towards increased automation in both professional and personal spheres, leading + to enhanced productivity and new business models. However, this automation introduces + challenges such as job displacement and ethical considerations regarding decision-making + by AI. It is essential to foster an ongoing dialogue on the implications of + AI agents to ensure responsible development and integration into our daily lives. + As AI agents continue to evolve, they will undoubtedly play a pivotal role in + shaping the future of technology and its intersection with societal dynamics, + making it critical for us to engage thoughtfully with this emerging paradigm.\",\n + \ \"refusal\": null\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 289,\n \"completion_tokens\": + 506,\n \"total_tokens\": 795,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_0aa8d3e20b\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f6255b1f832a519-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 22 Dec 2024 18:57:04 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '7836' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999630' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_c14268346d6ce72ceea4b1472f73c5ae + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + CtsBCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSsgEKEgoQY3Jld2FpLnRl + bGVtZXRyeRKbAQoQ7U/1ZgBSTkCXtesUNPA2URIIrnRWFVT58Z8qClRvb2wgVXNhZ2UwATl4lN3i + vZQTGEGgevzivZQTGEoaCg5jcmV3YWlfdmVyc2lvbhIICgYwLjg2LjBKJwoJdG9vbF9uYW1lEhoK + GEFzayBxdWVzdGlvbiB0byBjb3dvcmtlckoOCghhdHRlbXB0cxICGAF6AhgBhQEAAQAA + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '222' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.27.0 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Sun, 22 Dec 2024 18:57:09 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are CEO. You''re an long + time CEO of a content creation agency with a Senior Writer on the team. You''re + now working on a new project and want to make sure the content produced is amazing.\nYour + personal goal is: Make sure the writers in your company produce amazing content.\nYou + ONLY have access to the following tools, and should NEVER make up tools that + are not listed here:\n\nTool Name: Test Tool\nTool Arguments: {''query'': {''description'': + ''Query to process'', ''type'': ''str''}}\nTool Description: A test tool that + just returns the input\nTool Name: Delegate work to coworker\nTool Arguments: + {''task'': {''description'': ''The task to delegate'', ''type'': ''str''}, ''context'': + {''description'': ''The context for the task'', ''type'': ''str''}, ''coworker'': + {''description'': ''The role/name of the coworker to delegate to'', ''type'': + ''str''}}\nTool Description: Delegate a specific task to one of the following + coworkers: Senior Writer\nThe input to this tool should be the coworker, the + task you want them to do, and ALL necessary context to execute the task, they + know nothing about the task, so share absolute everything you know, don''t reference + things but instead explain them.\nTool Name: Ask question to coworker\nTool + Arguments: {''question'': {''description'': ''The question to ask'', ''type'': + ''str''}, ''context'': {''description'': ''The context for the question'', ''type'': + ''str''}, ''coworker'': {''description'': ''The role/name of the coworker to + ask'', ''type'': ''str''}}\nTool Description: Ask a specific question to one + of the following coworkers: Senior Writer\nThe input to this tool should be + the coworker, the question you have for them, and ALL necessary context to ask + the question properly, they know nothing about the question, so share absolute + everything you know, don''t reference things but instead explain them.\n\nUse + the following format:\n\nThought: you should always think about what to do\nAction: + the action to take, only one name of [Test Tool, Delegate work to coworker, + Ask question to coworker], just the name, exactly as it''s written.\nAction + Input: the input to the action, just a simple python dictionary, enclosed in + curly braces, using \" to wrap keys and values.\nObservation: the result of + the action\n\nOnce all necessary information is gathered:\n\nThought: I now + know the final answer\nFinal Answer: the final answer to the original input + question"}, {"role": "user", "content": "\nCurrent Task: Produce and amazing + 1 paragraph draft of an article about AI Agents.\n\nThis is the expect criteria + for your final answer: A 4 paragraph article about AI.\nyou MUST return the + actual complete content as the final answer, not a summary.\n\nBegin! This is + VERY important to you, use the tools available and give your best Final Answer, + your job depends on it!\n\nThought:"}, {"role": "assistant", "content": "I need + to gather information and insights to ensure the Senior Writer produces a high-quality + draft about AI Agents, which will then serve as a foundation for the complete + article.\n\nAction: Ask question to coworker \nAction Input: {\"question\":\"Can + you provide a detailed overview of what AI Agents are, their functionalities, + and their applications in real-world scenarios? Please include examples of how + they are being used in various industries, and discuss their potential impact + on the future of technology and society.\",\"context\":\"We are looking to create + a comprehensive understanding of AI Agents as part of a four-paragraph article. + This will help generate a high-quality draft for the article.\",\"coworker\":\"Senior + Writer\"} \nObservation: **Overview of AI Agents** \nAI agents are advanced + software systems designed to autonomously perform tasks, make decisions, and + learn from their environments without needing constant human intervention. They + leverage machine learning, natural language processing, and various AI techniques + to simulate human-like understanding and autonomy. These agents can be categorized + into three types: reactive agents (which operate purely based on their environment), + deliberative agents (which can make decisions based on reasoning), and hybrid + agents that incorporate aspects of both types. Their ability to adapt and learn + over time makes them instrumental in automating processes across various domains.\n\n**Functionalities + of AI Agents** \nThe core functionalities of AI agents include perception, + action, learning, and interaction. They perceive data through sensors or data + feeds, process information through algorithms, and take actions based on this + data. Machine learning allows them to refine their performance over time by + analyzing outcomes and adjusting their strategies accordingly. Interaction capabilities + enable them to communicate with users, providing insights, answering queries, + or even negotiating in some cases. These functionalities make AI agents invaluable + for tasks such as predictive analytics, personal assistance, and real-time decision-making + in complex systems.\n\n**Applications in Various Industries** \nAI agents are + already being utilized across multiple industries, demonstrating their versatility + and efficiency. In healthcare, AI agents assist in diagnostics by analyzing + medical records and suggesting treatment plans tailored to individual patients. + In finance, they power robo-advisors that manage investment portfolios, automate + trading strategies, and provide financial advice based on real-time market analysis. + Furthermore, in customer service, AI chatbots serve as virtual assistants, enhancing + user experience by providing instant support and resolving queries without human + intervention. The logistics and supply chain industries have also seen AI agents + optimize inventory management and route planning, significantly improving operational + efficiency.\n\n**Future Impact on Technology and Society** \nThe ongoing development + of AI agents is poised to have a profound impact on technology and society. + As these agents become more sophisticated, we can anticipate a shift towards + increased automation in both professional and personal spheres, leading to enhanced + productivity and new business models. However, this automation introduces challenges + such as job displacement and ethical considerations regarding decision-making + by AI. It is essential to foster an ongoing dialogue on the implications of + AI agents to ensure responsible development and integration into our daily lives. + As AI agents continue to evolve, they will undoubtedly play a pivotal role in + shaping the future of technology and its intersection with societal dynamics, + making it critical for us to engage thoughtfully with this emerging paradigm."}], + "model": "gpt-4o-mini", "stop": ["\nObservation:"], "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '6755' + content-type: + - application/json + cookie: + - __cf_bm=rVquIlcnYXc7wMkbKG5Ii90HxfQ_ukNJjDgSHhsWb1k-1734893816-1.0.1.1-33qDl8KNWcxLAGBuPhT8FrZ6QUnEy9oOYh2Fp2hIjDnF.cQlyrgxiWcuHljTTxG_mH7eQrf1AHJ6p8sxZJZ30A; + _cfuvid=xqgLJsf3h5lBKZFTADRNNUqizeChNBBFoLvWiR2WPnw-1734893816555-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AhLQOmLKuevpaWtRyyhHjHVYqvNVk\",\n \"object\": + \"chat.completion\",\n \"created\": 1734893824,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"Thought: I have received a comprehensive + overview from the Senior Writer that includes the necessary information about + AI Agents, their functionalities, applications, and future implications. Now, + I can compile this into a final answer following the specified format: a complete + four-paragraph article.\\n\\nFinal Answer: \\n\\n**Overview of AI Agents** \\nAI + agents are advanced software systems designed to autonomously perform tasks, + make decisions, and learn from their environments without needing constant human + intervention. They leverage machine learning, natural language processing, and + various AI techniques to simulate human-like understanding and autonomy. These + agents can be categorized into three types: reactive agents (which operate purely + based on their environment), deliberative agents (which can make decisions based + on reasoning), and hybrid agents that incorporate aspects of both types. Their + ability to adapt and learn over time makes them instrumental in automating processes + across various domains.\\n\\n**Functionalities of AI Agents** \\nThe core functionalities + of AI agents include perception, action, learning, and interaction. They perceive + data through sensors or data feeds, process information through algorithms, + and take actions based on this data. Machine learning allows them to refine + their performance over time by analyzing outcomes and adjusting their strategies + accordingly. Interaction capabilities enable them to communicate with users, + providing insights, answering queries, or even negotiating in some cases. These + functionalities make AI agents invaluable for tasks such as predictive analytics, + personal assistance, and real-time decision-making in complex systems.\\n\\n**Applications + in Various Industries** \\nAI agents are already being utilized across multiple + industries, demonstrating their versatility and efficiency. In healthcare, AI + agents assist in diagnostics by analyzing medical records and suggesting treatment + plans tailored to individual patients. In finance, they power robo-advisors + that manage investment portfolios, automate trading strategies, and provide + financial advice based on real-time market analysis. Furthermore, in customer + service, AI chatbots serve as virtual assistants, enhancing user experience + by providing instant support and resolving queries without human intervention. + The logistics and supply chain industries have also seen AI agents optimize + inventory management and route planning, significantly improving operational + efficiency.\\n\\n**Future Impact on Technology and Society** \\nThe ongoing + development of AI agents is poised to have a profound impact on technology and + society. As these agents become more sophisticated, we can anticipate a shift + towards increased automation in both professional and personal spheres, leading + to enhanced productivity and new business models. However, this automation introduces + challenges such as job displacement and ethical considerations regarding decision-making + by AI. It is essential to foster an ongoing dialogue on the implications of + AI agents to ensure responsible development and integration into our daily lives. + As AI agents continue to evolve, they will undoubtedly play a pivotal role in + shaping the future of technology and its intersection with societal dynamics, + making it critical for us to engage thoughtfully with this emerging paradigm.\",\n + \ \"refusal\": null\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1242,\n \"completion_tokens\": + 550,\n \"total_tokens\": 1792,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_0aa8d3e20b\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f6255e49b37a519-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 22 Dec 2024 18:57:12 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '7562' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149998353' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_a812bbb85b3d785660c4662212614ab9 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/cassettes/test_multimodal_agent_live_image_analysis.yaml b/tests/cassettes/test_multimodal_agent_live_image_analysis.yaml new file mode 100644 index 000000000..76417ce27 --- /dev/null +++ b/tests/cassettes/test_multimodal_agent_live_image_analysis.yaml @@ -0,0 +1,481 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are Image Analyst. You''re + an expert at visual analysis, trained to notice and describe details in images.\nYour + personal goal is: Analyze images with high attention to detail\nYou ONLY have + access to the following tools, and should NEVER make up tools that are not listed + here:\n\nTool Name: Add image to content\nTool Arguments: {''image_url'': {''description'': + ''The URL or path of the image to add'', ''type'': ''str''}, ''action'': {''description'': + ''Optional context or question about the image'', ''type'': ''str''}}\nTool + Description: See image to understand it''s content, you can optionally ask a + question about the image\n\nUse the following format:\n\nThought: you should + always think about what to do\nAction: the action to take, only one name of + [Add image to content], just the name, exactly as it''s written.\nAction Input: + the input to the action, just a simple python dictionary, enclosed in curly + braces, using \" to wrap keys and values.\nObservation: the result of the action\n\nOnce + all necessary information is gathered:\n\nThought: I now know the final answer\nFinal + Answer: the final answer to the original input question"}, {"role": "user", + "content": "\nCurrent Task: \n Analyze the provided image and describe + what you see in detail.\n Focus on main elements, colors, composition, + and any notable details.\n Image: https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k=\n \n\nThis + is the expect criteria for your final answer: A comprehensive description of + the image contents.\nyou MUST return the actual complete content as the final + answer, not a summary.\n\nBegin! This is VERY important to you, use the tools + available and give your best Final Answer, your job depends on it!\n\nThought:"}], + "model": "gpt-4o", "stop": ["\nObservation:"], "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1948' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AiuIfzzcje5KdvKIG5CkFeORroiKk\",\n \"object\": + \"chat.completion\",\n \"created\": 1735266213,\n \"model\": \"gpt-4o-2024-08-06\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"Action: Add image to content\\nAction + Input: {\\\"image_url\\\": \\\"https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k=\\\", + \\\"action\\\": \\\"Analyze the provided image and describe what you see in + detail.\\\"}\",\n \"refusal\": null\n },\n \"logprobs\": null,\n + \ \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 417,\n \"completion_tokens\": 103,\n \"total_tokens\": 520,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_5f20662549\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f85d96b280df217-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Fri, 27 Dec 2024 02:23:35 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=kJ1pw1xjCMSxjHSS8iJC5z_j2PZxl.i387KCpj9xNZU-1735266215-1.0.1.1-Ybg0wVTsrBlpVZmtQyA1ullY8m3v2Ix0N_SYlhr9z7zKfbLeqGZEVL37YSY.dvIiLVY3XPZzMtG8Xwo6UucW6A; + path=/; expires=Fri, 27-Dec-24 02:53:35 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=v_wJZ5m7qCjrnRfks0gT2GAk9yR14BdIDAQiQR7xxI8-1735266215000-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1212' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '30000000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '29999539' + x-ratelimit-reset-requests: + - 6ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_663a2b18099a18361d6b02befc175289 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + Co4LCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkS5QoKEgoQY3Jld2FpLnRl + bGVtZXRyeRKjBwoQHmzzumMNXHOgpJ4zCIxJSxII72WnLlLfRyYqDENyZXcgQ3JlYXRlZDABOQjB + gFxt5xQYQYhMiVxt5xQYShoKDmNyZXdhaV92ZXJzaW9uEggKBjAuODYuMEoaCg5weXRob25fdmVy + c2lvbhIICgYzLjExLjdKLgoIY3Jld19rZXkSIgogZTM5NTY3YjUwNTI5MDljYTMzNDA5ODRiODM4 + OTgwZWFKMQoHY3Jld19pZBImCiQ4MDA0YTA1NC0zYjNkLTQ4OGEtYTlkNC1kZWQzMDVhMDIxY2FK + HAoMY3Jld19wcm9jZXNzEgwKCnNlcXVlbnRpYWxKEQoLY3Jld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ODBlYUoxCgdjcmV3X2lkEiYKJDgwMDRhMDU0LTNiM2Qt + NDg4YS1hOWQ0LWRlZDMwNWEwMjFjYUouCgh0YXNrX2tleRIiCiBhOWE3NmNhNjk1N2QwYmZmYTY5 + ZWFiMjBiNjY0ODIyYkoxCgd0YXNrX2lkEiYKJGE3MWJkOWU0LTA3N2QtNGYxNC04ODQxLTcwYzBl + YzgwZmQyY3oCGAGFAQABAAASlwEKECyaQQK8JkKLh6S2mWHTeDgSCPWCpr7v9CQZKgpUb29sIFVz + YWdlMAE5MLyst23nFBhBOJy/t23nFBhKGgoOY3Jld2FpX3ZlcnNpb24SCAoGMC44Ni4wSiMKCXRv + b2xfbmFtZRIWChRBZGQgaW1hZ2UgdG8gY29udGVudEoOCghhdHRlbXB0cxICGAF6AhgBhQEAAQAA + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1425' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.27.0 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Fri, 27 Dec 2024 02:23:39 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are Image Analyst. You''re + an expert at visual analysis, trained to notice and describe details in images.\nYour + personal goal is: Analyze images with high attention to detail\nYou ONLY have + access to the following tools, and should NEVER make up tools that are not listed + here:\n\nTool Name: Add image to content\nTool Arguments: {''image_url'': {''description'': + ''The URL or path of the image to add'', ''type'': ''str''}, ''action'': {''description'': + ''Optional context or question about the image'', ''type'': ''str''}}\nTool + Description: See image to understand it''s content, you can optionally ask a + question about the image\n\nUse the following format:\n\nThought: you should + always think about what to do\nAction: the action to take, only one name of + [Add image to content], just the name, exactly as it''s written.\nAction Input: + the input to the action, just a simple python dictionary, enclosed in curly + braces, using \" to wrap keys and values.\nObservation: the result of the action\n\nOnce + all necessary information is gathered:\n\nThought: I now know the final answer\nFinal + Answer: the final answer to the original input question"}, {"role": "user", + "content": "\nCurrent Task: \n Analyze the provided image and describe + what you see in detail.\n Focus on main elements, colors, composition, + and any notable details.\n Image: https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k=\n \n\nThis + is the expect criteria for your final answer: A comprehensive description of + the image contents.\nyou MUST return the actual complete content as the final + answer, not a summary.\n\nBegin! This is VERY important to you, use the tools + available and give your best Final Answer, your job depends on it!\n\nThought:"}, + {"role": "user", "content": [{"type": "text", "text": "Analyze the provided + image and describe what you see in detail."}, {"type": "image_url", "image_url": + {"url": "https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k="}}]}], + "model": "gpt-4o", "stop": ["\nObservation:"], "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '2279' + content-type: + - application/json + cookie: + - __cf_bm=kJ1pw1xjCMSxjHSS8iJC5z_j2PZxl.i387KCpj9xNZU-1735266215-1.0.1.1-Ybg0wVTsrBlpVZmtQyA1ullY8m3v2Ix0N_SYlhr9z7zKfbLeqGZEVL37YSY.dvIiLVY3XPZzMtG8Xwo6UucW6A; + _cfuvid=v_wJZ5m7qCjrnRfks0gT2GAk9yR14BdIDAQiQR7xxI8-1735266215000-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AiuIiqT33ROFMdw1gNmqH9jiw6PfF\",\n \"object\": + \"chat.completion\",\n \"created\": 1735266216,\n \"model\": \"gpt-4o-2024-08-06\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"The image is an aerial view of Lower + Manhattan in New York City. \\n\\nMain Elements:\\n- The One World Trade Center + tower stands prominently, distinguishable by its sleek, tapering structure reaching + into the sky, surrounded by other skyscrapers.\\n- Skyscrapers in varying heights + and architectural styles, fill the densely packed urban landscape.\\n- A waterfront + is visible at the edges, with docks and piers extending into the water.\\n\\nColors:\\n- + The buildings exhibit a mix of colors, predominantly grays, whites, and browns, + against the blues of the sky and water.\\n- There's a section of greenery visible, + likely a park or recreational space, offering a contrast with its vibrant green + hues.\\n\\nComposition:\\n- The angle of the photograph showcases the expanse + of the city, highlighting the density and scale of the buildings.\\n- Water + borders the city on two prominent sides, creating a natural boundary and enhancing + the island's urban island feel.\\n\\nNotable Details:\\n- The image captures + the iconic layout of Manhattan, with the surrounding Hudson River and New York + Harbor visible in the background.\\n- Beyond Lower Manhattan, more of the cityscape + stretches into the distance, illustrating the vastness of New York City.\\n- + The day appears clear and sunny, with shadows casting from the buildings, indicating + time in the morning or late afternoon.\\n\\nOverall, the image is a striking + depiction of the dynamic and bustling environment of New York's Lower Manhattan, + encapsulating its urban character and proximity to the water.\",\n \"refusal\": + null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 858,\n \"completion_tokens\": + 295,\n \"total_tokens\": 1153,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_5f20662549\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f85d9741d0cf217-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Fri, 27 Dec 2024 02:23:40 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '5136' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-input-images: + - '50000' + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '30000000' + x-ratelimit-remaining-input-images: + - '49999' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '29998756' + x-ratelimit-reset-input-images: + - 1ms + x-ratelimit-reset-requests: + - 6ms + x-ratelimit-reset-tokens: + - 2ms + x-request-id: + - req_57a7430712d4ff4a81f600ffb94d3b6e + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Image Analyst. You''re + an expert at visual analysis, trained to notice and describe details in images.\nYour + personal goal is: Analyze images with high attention to detail\nYou ONLY have + access to the following tools, and should NEVER make up tools that are not listed + here:\n\nTool Name: Add image to content\nTool Arguments: {''image_url'': {''description'': + ''The URL or path of the image to add'', ''type'': ''str''}, ''action'': {''description'': + ''Optional context or question about the image'', ''type'': ''str''}}\nTool + Description: See image to understand it''s content, you can optionally ask a + question about the image\n\nUse the following format:\n\nThought: you should + always think about what to do\nAction: the action to take, only one name of + [Add image to content], just the name, exactly as it''s written.\nAction Input: + the input to the action, just a simple python dictionary, enclosed in curly + braces, using \" to wrap keys and values.\nObservation: the result of the action\n\nOnce + all necessary information is gathered:\n\nThought: I now know the final answer\nFinal + Answer: the final answer to the original input question"}, {"role": "user", + "content": "\nCurrent Task: \n Analyze the provided image and describe + what you see in detail.\n Focus on main elements, colors, composition, + and any notable details.\n Image: https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k=\n \n\nThis + is the expect criteria for your final answer: A comprehensive description of + the image contents.\nyou MUST return the actual complete content as the final + answer, not a summary.\n\nBegin! This is VERY important to you, use the tools + available and give your best Final Answer, your job depends on it!\n\nThought:"}, + {"role": "user", "content": [{"type": "text", "text": "Analyze the provided + image and describe what you see in detail."}, {"type": "image_url", "image_url": + {"url": "https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k="}}]}, + {"role": "user", "content": "I did it wrong. Invalid Format: I missed the ''Action:'' + after ''Thought:''. I will do right next, and don''t use a tool I have already + used.\n\nIf you don''t need to use any more tools, you must give your best complete + final answer, make sure it satisfies the expected criteria, use the EXACT format + below:\n\nThought: I now can give a great answer\nFinal Answer: my best complete + final answer to the task.\n\n"}], "model": "gpt-4o", "stop": ["\nObservation:"], + "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '2717' + content-type: + - application/json + cookie: + - __cf_bm=kJ1pw1xjCMSxjHSS8iJC5z_j2PZxl.i387KCpj9xNZU-1735266215-1.0.1.1-Ybg0wVTsrBlpVZmtQyA1ullY8m3v2Ix0N_SYlhr9z7zKfbLeqGZEVL37YSY.dvIiLVY3XPZzMtG8Xwo6UucW6A; + _cfuvid=v_wJZ5m7qCjrnRfks0gT2GAk9yR14BdIDAQiQR7xxI8-1735266215000-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AiuInuYNldaQVo6B1EsEquT1VFMN7\",\n \"object\": + \"chat.completion\",\n \"created\": 1735266221,\n \"model\": \"gpt-4o-2024-08-06\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"Thought: I now can give a great answer\\nFinal + Answer: The image is an aerial view of Lower Manhattan in New York City. The + photograph prominently features the cluster of skyscrapers that characterizes + the area, with One World Trade Center standing out as a particularly tall and + iconic structure. The buildings vary in color, with shades of glassy blue, grey, + and natural stone dominating the skyline. In the bottom part of the image, there + is a green space, likely Battery Park, providing a stark contrast to the dense + urban environment, with trees and pathways visible. The water surrounding Manhattan + is a deep blue, and several piers jut into the harbor. The Hudson River is visible + on the left, and the East River can be seen on the right, framing the island. + The overall composition captures the bustling and vibrant nature of New York\u2019s + financial hub, with bright sunlight illuminating the buildings, casting sharp + shadows and enhancing the depth of the cityscape. The sky is clear, suggesting + a sunny day with good visibility.\",\n \"refusal\": null\n },\n + \ \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n + \ \"usage\": {\n \"prompt_tokens\": 952,\n \"completion_tokens\": 203,\n + \ \"total_tokens\": 1155,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_5f20662549\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f85d995ad1ef217-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Fri, 27 Dec 2024 02:23:43 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '3108' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-input-images: + - '50000' + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '30000000' + x-ratelimit-remaining-input-images: + - '49999' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '29998656' + x-ratelimit-reset-input-images: + - 1ms + x-ratelimit-reset-requests: + - 6ms + x-ratelimit-reset-tokens: + - 2ms + x-request-id: + - req_45f0e3d457a18f973a59074d16f137b6 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/cassettes/test_task_tools_override_agent_tools.yaml b/tests/cassettes/test_task_tools_override_agent_tools.yaml new file mode 100644 index 000000000..971363af4 --- /dev/null +++ b/tests/cassettes/test_task_tools_override_agent_tools.yaml @@ -0,0 +1,569 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are Researcher. You''re + an expert researcher, specialized in technology, software engineering, AI and + startups. You work as a freelancer and is now working on doing research and + analysis for a new customer.\nYour personal goal is: Make the best research + and analysis on content about AI and AI agents\nYou ONLY have access to the + following tools, and should NEVER make up tools that are not listed here:\n\nTool + Name: Test Tool\nTool Arguments: {''query'': {''description'': ''Query to process'', + ''type'': ''str''}}\nTool Description: A test tool that just returns the input\n\nUse + the following format:\n\nThought: you should always think about what to do\nAction: + the action to take, only one name of [Test Tool], just the name, exactly as + it''s written.\nAction Input: the input to the action, just a simple python + dictionary, enclosed in curly braces, using \" to wrap keys and values.\nObservation: + the result of the action\n\nOnce all necessary information is gathered:\n\nThought: + I now know the final answer\nFinal Answer: the final answer to the original + input question"}, {"role": "user", "content": "\nCurrent Task: Write a test + task\n\nThis is the expect criteria for your final answer: Test output\nyou + MUST return the actual complete content as the final answer, not a summary.\n\nBegin! + This is VERY important to you, use the tools available and give your best Final + Answer, your job depends on it!\n\nThought:"}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"], "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1536' + content-type: + - application/json + cookie: + - _cfuvid=2u_Xw.i716TDjD2vb2mvMyWxhA4q1MM1JvbrA8CNZpI-1734895557894-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AhQfznhDMtsr58XvTuRDZoB1kxwfK\",\n \"object\": + \"chat.completion\",\n \"created\": 1734914011,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"I need to come up with a suitable test + task that meets the criteria provided. I will focus on outlining a clear and + effective test task related to AI and AI agents.\\n\\nAction: Test Tool\\nAction + Input: {\\\"query\\\": \\\"Create a test task that involves evaluating the performance + of an AI agent in a given scenario, including criteria for success, tools required, + and process for assessment.\\\"}\",\n \"refusal\": null\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 298,\n \"completion_tokens\": 78,\n \"total_tokens\": 376,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_d02d531b47\"\n}\n" + headers: + CF-RAY: + - 8f6442b868fda486-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 23 Dec 2024 00:33:32 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=i6jvNjhsDne300GPAeEmyiJJKYqy7OPuamFG_kht3KE-1734914012-1.0.1.1-tCeVANAF521vkXpBdgYw.ov.fYUr6t5QC4LG_DugWyzu4C60Pi2CruTVniUgfCvkcu6rdHA5DwnaEZf2jFaRCQ; + path=/; expires=Mon, 23-Dec-24 01:03:32 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1400' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999642' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_c3e50e9ca9dc22de5572692e1a9c0f16 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + CrBzCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSh3MKEgoQY3Jld2FpLnRl + bGVtZXRyeRLUCwoQEr8cFisEEEEUtXBvovq6lhIIYdkQ+ekBh3wqDENyZXcgQ3JlYXRlZDABOThc + YLAZpxMYQfCuabAZpxMYShoKDmNyZXdhaV92ZXJzaW9uEggKBjAuODYuMEoaCg5weXRob25fdmVy + c2lvbhIICgYzLjExLjdKLgoIY3Jld19rZXkSIgogZGUxMDFkODU1M2VhMDI0NTM3YTA4ZjgxMmVl + NmI3NGFKMQoHY3Jld19pZBImCiRmNTc2MjViZC1jZmY3LTRlNGMtYWM1Zi0xZWFiNjQyMz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goIY3Jld19rZXkSIgogOTgyNDYwZWUyZGQyY2YxMmE3MTM4YjcwODU5ZmU4MTdKMQoHY3Jld19p + ZBImCiRkM2Q4NmM2YS01Y2YyLTQwYjQtYTFkZC0zMDk1NjI4N2M1YTdKLgoIdGFza19rZXkSIgog + ZjgzOWM4N2MzZDc1N2M4ODdmNGNlNzRkMTg2NGIwMmFKMQoHdGFza19pZBImCiRjM2Y2NjY2MS00 + YWNjLTQ5OWQtYjJkNC1kZjI0Nzg1MTJhZGZ6AhgBhQEAAQAAEowBChDdoNfQMW/Om7LQU9gZGDrl + Egjw71DM3bnOWCoKVG9vbCBVc2FnZTABOUgPFC8apxMYQdhtKi8apxMYShoKDmNyZXdhaV92ZXJz + aW9uEggKBjAuODYuMEoYCgl0b29sX25hbWUSCwoJVGVzdCBUb29sSg4KCGF0dGVtcHRzEgIYAXoC + GAGFAQABAAA= + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14771' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.27.0 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Mon, 23 Dec 2024 00:33:37 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are Researcher. You''re + an expert researcher, specialized in technology, software engineering, AI and + startups. You work as a freelancer and is now working on doing research and + analysis for a new customer.\nYour personal goal is: Make the best research + and analysis on content about AI and AI agents\nYou ONLY have access to the + following tools, and should NEVER make up tools that are not listed here:\n\nTool + Name: Test Tool\nTool Arguments: {''query'': {''description'': ''Query to process'', + ''type'': ''str''}}\nTool Description: A test tool that just returns the input\n\nUse + the following format:\n\nThought: you should always think about what to do\nAction: + the action to take, only one name of [Test Tool], just the name, exactly as + it''s written.\nAction Input: the input to the action, just a simple python + dictionary, enclosed in curly braces, using \" to wrap keys and values.\nObservation: + the result of the action\n\nOnce all necessary information is gathered:\n\nThought: + I now know the final answer\nFinal Answer: the final answer to the original + input question"}, {"role": "user", "content": "\nCurrent Task: Write a test + task\n\nThis is the expect criteria for your final answer: Test output\nyou + MUST return the actual complete content as the final answer, not a summary.\n\nBegin! + This is VERY important to you, use the tools available and give your best Final + Answer, your job depends on it!\n\nThought:"}, {"role": "assistant", "content": + "I need to come up with a suitable test task that meets the criteria provided. + I will focus on outlining a clear and effective test task related to AI and + AI agents.\n\nAction: Test Tool\nAction Input: {\"query\": \"Create a test task + that involves evaluating the performance of an AI agent in a given scenario, + including criteria for success, tools required, and process for assessment.\"}\nObservation: + Processed: Create a test task that involves evaluating the performance of an + AI agent in a given scenario, including criteria for success, tools required, + and process for assessment."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"], + "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '2160' + content-type: + - application/json + cookie: + - _cfuvid=2u_Xw.i716TDjD2vb2mvMyWxhA4q1MM1JvbrA8CNZpI-1734895557894-0.0.1.1-604800000; + __cf_bm=i6jvNjhsDne300GPAeEmyiJJKYqy7OPuamFG_kht3KE-1734914012-1.0.1.1-tCeVANAF521vkXpBdgYw.ov.fYUr6t5QC4LG_DugWyzu4C60Pi2CruTVniUgfCvkcu6rdHA5DwnaEZf2jFaRCQ + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.11.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AhQg0Cx1FED7gOwMpJUD5cQxVzQBK\",\n \"object\": + \"chat.completion\",\n \"created\": 1734914012,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"Thought: I need to compile a complete + and detailed test task based on the processed input, ensuring it includes all + necessary components as per the expect criteria.\\n\\nFinal Answer: \\n### Test + Task: Evaluating the Performance of an AI Agent\\n\\n**Objective:** \\nTo evaluate + the performance of an AI agent in simulating conversation with users in a customer + service context.\\n\\n**Scenario:**\\nAn AI agent is tasked with handling customer + inquiries on an e-commerce platform. The agent must respond to questions about + product availability, order tracking, returns, and other common queries.\\n\\n**Criteria + for Success:**\\n1. **Accuracy:** The AI should provide correct information + in at least 90% of the interactions.\\n2. **Response Time:** The average response + time should be under 2 seconds.\\n3. **User Satisfaction:** Aim for a user satisfaction + score of 85% or higher based on follow-up surveys after interactions.\\n4. **Fallback + Rate:** The AI should not default to a human agent more than 10% of the time.\\n\\n**Tools + Required:**\\n- Chatbot development platform (e.g., Dialogflow, Rasa)\\n- Metrics + tracking software (to measure accuracy, response times, and user satisfaction)\\n- + Survey tool (e.g., Google Forms, SurveyMonkey) for feedback collection\\n\\n**Process + for Assessment:**\\n1. **Setup:** Deploy the AI agent on a testing environment + simulating real customer inquiries.\\n2. **Data Collection:** Run the test for + a predetermined period (e.g., one week) or until a set number of interactions + (e.g., 1000).\\n3. **Measurement:**\\n - Record the interactions and analyze + the accuracy of the AI's responses.\\n - Measure the average response time + for each interaction.\\n - Collect user satisfaction scores via surveys sent + after the interaction.\\n4. **Analysis:** Compile the data to see if the AI + met the success criteria. Identify strengths and weaknesses in the responses.\\n5. + **Review:** Share findings with the development team to strategize improvements.\\n\\nThis + detailed task will help assess the AI agent\u2019s capabilities and provide + insights for further enhancements.\",\n \"refusal\": null\n },\n + \ \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n + \ \"usage\": {\n \"prompt_tokens\": 416,\n \"completion_tokens\": 422,\n + \ \"total_tokens\": 838,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_d02d531b47\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f6442c2ba15a486-GRU + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 23 Dec 2024 00:33:39 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '6734' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999497' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_7d8df8b840e279bd64280d161d854161 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/crew_test.py b/tests/crew_test.py index caecf4524..2003ddada 100644 --- a/tests/crew_test.py +++ b/tests/crew_test.py @@ -332,22 +332,31 @@ def test_manager_agent_delegating_to_assigned_task_agent(): tasks=[task], ) - crew.kickoff() - - # Check if the manager agent has the correct tools - assert crew.manager_agent is not None - assert crew.manager_agent.tools is not None - - assert len(crew.manager_agent.tools) == 2 - assert ( - "Delegate a specific task to one of the following coworkers: Researcher\n" - in crew.manager_agent.tools[0].description - ) - assert ( - "Ask a specific question to one of the following coworkers: Researcher\n" - in crew.manager_agent.tools[1].description + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" ) + # Because we are mocking execute_sync, we never hit the underlying _execute_core + # which sets the output attribute of the task + task.output = mock_task_output + + with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Verify execute_sync was called once + mock_execute_sync.assert_called_once() + + # Get the tools argument from the call + _, kwargs = mock_execute_sync.call_args + tools = kwargs['tools'] + + # Verify the delegation tools were passed correctly + assert len(tools) == 2 + assert any("Delegate a specific task to one of the following coworkers: Researcher" in tool.description for tool in tools) + assert any("Ask a specific question to one of the following coworkers: Researcher" in tool.description for tool in tools) + @pytest.mark.vcr(filter_headers=["authorization"]) def test_manager_agent_delegating_to_all_agents(): @@ -402,9 +411,255 @@ def test_crew_with_delegating_agents(): assert ( result.raw - == "This is the complete content as specified:\nArtificial Intelligence (AI) Agents are sophisticated computer programs designed to perform tasks that typically require human intelligence, such as decision making, problem-solving, and learning. These agents operate autonomously, utilizing vast amounts of data, advanced algorithms, and machine learning techniques to analyze their environment, adapt to new information, and improve their performance over time.\n\nThe significance of AI Agents lies in their transformative potential across various industries. In healthcare, for example, they assist in diagnosing diseases with greater accuracy and speed than human practitioners, offering personalized treatment plans by analyzing patient data. In finance, AI Agents predict market trends, manage risks, and even execute trades, contributing to more stable and profitable financial systems. Customer service sectors benefit significantly from AI Agents, as they provide personalized and efficient responses, often resolving issues faster than traditional methods.\n\nMoreover, AI Agents are also making substantial contributions in fields like education and manufacturing. In education, they offer tailored learning experiences by assessing individual student needs and adjusting teaching methods accordingly. They help educators identify students who might need additional support and provide resources to enhance learning outcomes. In manufacturing, AI Agents optimize production lines, predict equipment failures, and improve supply chain management, thus boosting productivity and reducing downtime.\n\nAs these AI-powered entities continue to evolve, they are not only enhancing operational efficiencies but also driving innovation and creating new opportunities for growth and development in every sector they penetrate. The future of AI Agents looks promising, with the potential to revolutionize the way we live and work, making processes more efficient, decisions more data-driven, and solutions more innovative than ever before." + == "In the rapidly evolving landscape of technology, AI agents have emerged as formidable tools, revolutionizing how we interact with data and automate tasks. These sophisticated systems leverage machine learning and natural language processing to perform a myriad of functions, from virtual personal assistants to complex decision-making companions in industries such as finance, healthcare, and education. By mimicking human intelligence, AI agents can analyze massive data sets at unparalleled speeds, enabling businesses to uncover valuable insights, enhance productivity, and elevate user experiences to unprecedented levels.\n\nOne of the most striking aspects of AI agents is their adaptability; they learn from their interactions and continuously improve their performance over time. This feature is particularly valuable in customer service where AI agents can address inquiries, resolve issues, and provide personalized recommendations without the limitations of human fatigue. Moreover, with intuitive interfaces, AI agents enhance user interactions, making technology more accessible and user-friendly, thereby breaking down barriers that have historically hindered digital engagement.\n\nDespite their immense potential, the deployment of AI agents raises important ethical and practical considerations. Issues related to privacy, data security, and the potential for job displacement necessitate thoughtful dialogue and proactive measures. Striking a balance between technological innovation and societal impact will be crucial as organizations integrate these agents into their operations. Additionally, ensuring transparency in AI decision-making processes is vital to maintain public trust as AI agents become an integral part of daily life.\n\nLooking ahead, the future of AI agents appears bright, with ongoing advancements promising even greater capabilities. As we continue to harness the power of AI, we can expect these agents to play a transformative role in shaping various sectors—streamlining workflows, enabling smarter decision-making, and fostering more personalized experiences. Embracing this technology responsibly can lead to a future where AI agents not only augment human effort but also inspire creativity and efficiency across the board, ultimately redefining our interaction with the digital world." ) +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_crew_with_delegating_agents_should_not_override_task_tools(): + from typing import Type + + from pydantic import BaseModel, Field + + from crewai.tools import BaseTool + + class TestToolInput(BaseModel): + """Input schema for TestTool.""" + query: str = Field(..., description="Query to process") + + class TestTool(BaseTool): + name: str = "Test Tool" + description: str = "A test tool that just returns the input" + args_schema: Type[BaseModel] = TestToolInput + + def _run(self, query: str) -> str: + return f"Processed: {query}" + + # Create a task with the test tool + tasks = [ + Task( + description="Produce and amazing 1 paragraph draft of an article about AI Agents.", + expected_output="A 4 paragraph article about AI.", + agent=ceo, + tools=[TestTool()], + ) + ] + + crew = Crew( + agents=[ceo, writer], + process=Process.sequential, + tasks=tasks, + ) + + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" + ) + + # Because we are mocking execute_sync, we never hit the underlying _execute_core + # which sets the output attribute of the task + tasks[0].output = mock_task_output + + with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Execute the task and verify both tools are present + _, kwargs = mock_execute_sync.call_args + tools = kwargs['tools'] + + assert any(isinstance(tool, TestTool) for tool in tools), "TestTool should be present" + assert any("delegate" in tool.name.lower() for tool in tools), "Delegation tool should be present" + +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_crew_with_delegating_agents_should_not_override_agent_tools(): + from typing import Type + + from pydantic import BaseModel, Field + + from crewai.tools import BaseTool + + class TestToolInput(BaseModel): + """Input schema for TestTool.""" + query: str = Field(..., description="Query to process") + + class TestTool(BaseTool): + name: str = "Test Tool" + description: str = "A test tool that just returns the input" + args_schema: Type[BaseModel] = TestToolInput + + def _run(self, query: str) -> str: + return f"Processed: {query}" + + new_ceo = ceo.model_copy() + new_ceo.tools = [TestTool()] + + # Create a task with the test tool + tasks = [ + Task( + description="Produce and amazing 1 paragraph draft of an article about AI Agents.", + expected_output="A 4 paragraph article about AI.", + agent=new_ceo + ) + ] + + crew = Crew( + agents=[new_ceo, writer], + process=Process.sequential, + tasks=tasks, + ) + + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" + ) + + # Because we are mocking execute_sync, we never hit the underlying _execute_core + # which sets the output attribute of the task + tasks[0].output = mock_task_output + + with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Execute the task and verify both tools are present + _, kwargs = mock_execute_sync.call_args + tools = kwargs['tools'] + + assert any(isinstance(tool, TestTool) for tool in new_ceo.tools), "TestTool should be present" + assert any("delegate" in tool.name.lower() for tool in tools), "Delegation tool should be present" + +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_task_tools_override_agent_tools(): + from typing import Type + + from pydantic import BaseModel, Field + + from crewai.tools import BaseTool + + class TestToolInput(BaseModel): + """Input schema for TestTool.""" + query: str = Field(..., description="Query to process") + + class TestTool(BaseTool): + name: str = "Test Tool" + description: str = "A test tool that just returns the input" + args_schema: Type[BaseModel] = TestToolInput + + def _run(self, query: str) -> str: + return f"Processed: {query}" + + class AnotherTestTool(BaseTool): + name: str = "Another Test Tool" + description: str = "Another test tool" + args_schema: Type[BaseModel] = TestToolInput + + def _run(self, query: str) -> str: + return f"Another processed: {query}" + + # Set agent tools + new_researcher = researcher.model_copy() + new_researcher.tools = [TestTool()] + + # Create task with different tools + task = Task( + description="Write a test task", + expected_output="Test output", + agent=new_researcher, + tools=[AnotherTestTool()] + ) + + crew = Crew( + agents=[new_researcher], + tasks=[task], + process=Process.sequential + ) + + crew.kickoff() + + # Verify task tools override agent tools + assert len(task.tools) == 1 # AnotherTestTool + assert any(isinstance(tool, AnotherTestTool) for tool in task.tools) + assert not any(isinstance(tool, TestTool) for tool in task.tools) + + # Verify agent tools remain unchanged + assert len(new_researcher.tools) == 1 + assert isinstance(new_researcher.tools[0], TestTool) + +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_task_tools_override_agent_tools_with_allow_delegation(): + """ + Test that task tools override agent tools while preserving delegation tools when allow_delegation=True + """ + from typing import Type + + from pydantic import BaseModel, Field + + from crewai.tools import BaseTool + + class TestToolInput(BaseModel): + query: str = Field(..., description="Query to process") + + class TestTool(BaseTool): + name: str = "Test Tool" + description: str = "A test tool that just returns the input" + args_schema: Type[BaseModel] = TestToolInput + + def _run(self, query: str) -> str: + return f"Processed: {query}" + + class AnotherTestTool(BaseTool): + name: str = "Another Test Tool" + description: str = "Another test tool" + args_schema: Type[BaseModel] = TestToolInput + + def _run(self, query: str) -> str: + return f"Another processed: {query}" + + # Set up agents with tools and allow_delegation + researcher_with_delegation = researcher.model_copy() + researcher_with_delegation.allow_delegation = True + researcher_with_delegation.tools = [TestTool()] + + writer_for_delegation = writer.model_copy() + + # Create a task with different tools + task = Task( + description="Write a test task", + expected_output="Test output", + agent=researcher_with_delegation, + tools=[AnotherTestTool()], + ) + + crew = Crew( + agents=[researcher_with_delegation, writer_for_delegation], + tasks=[task], + process=Process.sequential, + ) + + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" + ) + + # We mock execute_sync to verify which tools get used at runtime + with patch.object(Task, "execute_sync", return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Inspect the call kwargs to verify the actual tools passed to execution + _, kwargs = mock_execute_sync.call_args + used_tools = kwargs["tools"] + + # Confirm AnotherTestTool is present but TestTool is not + assert any(isinstance(tool, AnotherTestTool) for tool in used_tools), "AnotherTestTool should be present" + assert not any(isinstance(tool, TestTool) for tool in used_tools), "TestTool should not be present among used tools" + + # Confirm delegation tool(s) are present + assert any("delegate" in tool.name.lower() for tool in used_tools), "Delegation tool should be present" + + # Finally, make sure the agent's original tools remain unchanged + assert len(researcher_with_delegation.tools) == 1 + assert isinstance(researcher_with_delegation.tools[0], TestTool) @pytest.mark.vcr(filter_headers=["authorization"]) def test_crew_verbose_output(capsys): @@ -1193,12 +1448,22 @@ def test_code_execution_flag_adds_code_tool_upon_kickoff(): crew = Crew(agents=[programmer], tasks=[task]) - with patch.object(Agent, "execute_task") as executor: - executor.return_value = "ok" - crew.kickoff() - assert len(programmer.tools) == 1 - assert programmer.tools[0].__class__ == CodeInterpreterTool + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" + ) + with patch.object(Task, "execute_sync", return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Get the tools that were actually used in execution + _, kwargs = mock_execute_sync.call_args + used_tools = kwargs["tools"] + + # Verify that exactly one tool was used and it was a CodeInterpreterTool + assert len(used_tools) == 1, "Should have exactly one tool" + assert isinstance(used_tools[0], CodeInterpreterTool), "Tool should be CodeInterpreterTool" @pytest.mark.vcr(filter_headers=["authorization"]) def test_delegation_is_not_enabled_if_there_are_only_one_agent(): @@ -1307,21 +1572,37 @@ def test_hierarchical_crew_creation_tasks_with_agents(): process=Process.hierarchical, manager_llm="gpt-4o", ) - crew.kickoff() - assert crew.manager_agent is not None - assert crew.manager_agent.tools is not None - assert ( - "Delegate a specific task to one of the following coworkers: Senior Writer\n" - in crew.manager_agent.tools[0].description + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" ) + # Because we are mocking execute_sync, we never hit the underlying _execute_core + # which sets the output attribute of the task + task.output = mock_task_output + + with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Verify execute_sync was called once + mock_execute_sync.assert_called_once() + + # Get the tools argument from the call + _, kwargs = mock_execute_sync.call_args + tools = kwargs['tools'] + + # Verify the delegation tools were passed correctly + assert len(tools) == 2 + assert any("Delegate a specific task to one of the following coworkers: Senior Writer" in tool.description for tool in tools) + assert any("Ask a specific question to one of the following coworkers: Senior Writer" in tool.description for tool in tools) + @pytest.mark.vcr(filter_headers=["authorization"]) def test_hierarchical_crew_creation_tasks_with_async_execution(): """ - Agents are not required for tasks in a hierarchical process but sometimes they are still added - This test makes sure that the manager still delegates the task to the agent even if the agent is passed in the task + Tests that async tasks in hierarchical crews are handled correctly with proper delegation tools """ task = Task( description="Write one amazing paragraph about AI.", @@ -1337,14 +1618,35 @@ def test_hierarchical_crew_creation_tasks_with_async_execution(): manager_llm="gpt-4o", ) - crew.kickoff() - assert crew.manager_agent is not None - assert crew.manager_agent.tools is not None - assert ( - "Delegate a specific task to one of the following coworkers: Senior Writer\n" - in crew.manager_agent.tools[0].description + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" ) + # Create a mock Future that returns our TaskOutput + mock_future = MagicMock(spec=Future) + mock_future.result.return_value = mock_task_output + + # Because we are mocking execute_async, we never hit the underlying _execute_core + # which sets the output attribute of the task + task.output = mock_task_output + + with patch.object(Task, 'execute_async', return_value=mock_future) as mock_execute_async: + crew.kickoff() + + # Verify execute_async was called once + mock_execute_async.assert_called_once() + + # Get the tools argument from the call + _, kwargs = mock_execute_async.call_args + tools = kwargs['tools'] + + # Verify the delegation tools were passed correctly + assert len(tools) == 2 + assert any("Delegate a specific task to one of the following coworkers: Senior Writer\n" in tool.description for tool in tools) + assert any("Ask a specific question to one of the following coworkers: Senior Writer\n" in tool.description for tool in tools) + @pytest.mark.vcr(filter_headers=["authorization"]) def test_hierarchical_crew_creation_tasks_with_sync_last(): @@ -2583,3 +2885,244 @@ def test_hierarchical_verbose_false_manager_agent(): assert crew.manager_agent is not None assert not crew.manager_agent.verbose + + +def test_task_tools_preserve_code_execution_tools(): + """ + Test that task tools don't override code execution tools when allow_code_execution=True + """ + from typing import Type + + from crewai_tools import CodeInterpreterTool + from pydantic import BaseModel, Field + + from crewai.tools import BaseTool + + class TestToolInput(BaseModel): + """Input schema for TestTool.""" + query: str = Field(..., description="Query to process") + + class TestTool(BaseTool): + name: str = "Test Tool" + description: str = "A test tool that just returns the input" + args_schema: Type[BaseModel] = TestToolInput + + def _run(self, query: str) -> str: + return f"Processed: {query}" + + # Create a programmer agent with code execution enabled + programmer = Agent( + role="Programmer", + goal="Write code to solve problems.", + backstory="You're a programmer who loves to solve problems with code.", + allow_delegation=True, + allow_code_execution=True, + ) + + # Create a code reviewer agent + reviewer = Agent( + role="Code Reviewer", + goal="Review code for bugs and improvements", + backstory="You're an experienced code reviewer who ensures code quality and best practices.", + allow_delegation=True, + allow_code_execution=True, + ) + + # Create a task with its own tools + task = Task( + description="Write a program to calculate fibonacci numbers.", + expected_output="A working fibonacci calculator.", + agent=programmer, + tools=[TestTool()] + ) + + crew = Crew( + agents=[programmer, reviewer], + tasks=[task], + process=Process.sequential, + ) + + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" + ) + + with patch.object(Task, "execute_sync", return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Get the tools that were actually used in execution + _, kwargs = mock_execute_sync.call_args + used_tools = kwargs["tools"] + + # Verify all expected tools are present + assert any(isinstance(tool, TestTool) for tool in used_tools), "Task's TestTool should be present" + assert any(isinstance(tool, CodeInterpreterTool) for tool in used_tools), "CodeInterpreterTool should be present" + assert any("delegate" in tool.name.lower() for tool in used_tools), "Delegation tool should be present" + + # Verify the total number of tools (TestTool + CodeInterpreter + 2 delegation tools) + assert len(used_tools) == 4, "Should have TestTool, CodeInterpreter, and 2 delegation tools" + +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_multimodal_flag_adds_multimodal_tools(): + """ + Test that an agent with multimodal=True automatically has multimodal tools added to the task execution. + """ + from crewai.tools.agent_tools.add_image_tool import AddImageTool + + # Create an agent that supports multimodal + multimodal_agent = Agent( + role="Multimodal Analyst", + goal="Handle multiple media types (text, images, etc.).", + backstory="You're an agent specialized in analyzing text, images, and other media.", + allow_delegation=False, + multimodal=True, # crucial for adding the multimodal tool + ) + + # Create a dummy task + task = Task( + description="Describe what's in this image and generate relevant metadata.", + expected_output="An image description plus any relevant metadata.", + agent=multimodal_agent, + ) + + # Define a crew with the multimodal agent + crew = Crew(agents=[multimodal_agent], tasks=[task], process=Process.sequential) + + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" + ) + + # Mock execute_sync to verify the tools passed at runtime + with patch.object(Task, "execute_sync", return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Get the tools that were actually used in execution + _, kwargs = mock_execute_sync.call_args + used_tools = kwargs["tools"] + + # Check that the multimodal tool was added + assert any(isinstance(tool, AddImageTool) for tool in used_tools), ( + "AddImageTool should be present when agent is multimodal" + ) + + # Verify we have exactly one tool (just the AddImageTool) + assert len(used_tools) == 1, "Should only have the AddImageTool" + +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_multimodal_agent_image_tool_handling(): + """ + Test that multimodal agents properly handle image tools in the CrewAgentExecutor + """ + # Create a multimodal agent + multimodal_agent = Agent( + role="Image Analyst", + goal="Analyze images and provide descriptions", + backstory="You're an expert at analyzing and describing images.", + allow_delegation=False, + multimodal=True, + ) + + # Create a task that involves image analysis + task = Task( + description="Analyze this image and describe what you see.", + expected_output="A detailed description of the image.", + agent=multimodal_agent, + ) + + crew = Crew(agents=[multimodal_agent], tasks=[task]) + + # Mock the image tool response + mock_image_tool_result = { + "role": "user", + "content": [ + {"type": "text", "text": "Please analyze this image"}, + { + "type": "image_url", + "image_url": { + "url": "https://example.com/test-image.jpg", + }, + }, + ], + } + + # Create a mock task output for the final result + mock_task_output = TaskOutput( + description="Mock description", + raw="A detailed analysis of the image", + agent="Image Analyst" + ) + + with patch.object(Task, 'execute_sync') as mock_execute_sync: + # Set up the mock to return our task output + mock_execute_sync.return_value = mock_task_output + + # Execute the crew + crew.kickoff() + + # Get the tools that were passed to execute_sync + _, kwargs = mock_execute_sync.call_args + tools = kwargs['tools'] + + # Verify the AddImageTool is present and properly configured + image_tools = [tool for tool in tools if tool.name == "Add image to content"] + assert len(image_tools) == 1, "Should have exactly one AddImageTool" + + # Test the tool's execution + image_tool = image_tools[0] + result = image_tool._run( + image_url="https://example.com/test-image.jpg", + action="Please analyze this image" + ) + + # Verify the tool returns the expected format + assert result == mock_image_tool_result + assert result["role"] == "user" + assert len(result["content"]) == 2 + assert result["content"][0]["type"] == "text" + assert result["content"][1]["type"] == "image_url" + +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_multimodal_agent_live_image_analysis(): + """ + Test that multimodal agents can analyze images through a real API call + """ + # Create a multimodal agent + image_analyst = Agent( + role="Image Analyst", + goal="Analyze images with high attention to detail", + backstory="You're an expert at visual analysis, trained to notice and describe details in images.", + allow_delegation=False, + multimodal=True, + verbose=True, + llm="gpt-4o" + ) + + # Create a task for image analysis + analyze_image = Task( + description=""" + Analyze the provided image and describe what you see in detail. + Focus on main elements, colors, composition, and any notable details. + Image: {image_url} + """, + expected_output="A comprehensive description of the image contents.", + agent=image_analyst + ) + + # Create and run the crew + crew = Crew( + agents=[image_analyst], + tasks=[analyze_image] + ) + + # Execute with an image URL + result = crew.kickoff(inputs={ + "image_url": "https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k=" + }) + + # Verify we got a meaningful response + assert isinstance(result.raw, str) + assert len(result.raw) > 100 # Expecting a detailed analysis + assert "error" not in result.raw.lower() # No error messages in response \ No newline at end of file From 4cf8913d31e061e7bdfea7831773a3e63a04ef44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Igor?= Date: Fri, 27 Dec 2024 17:45:06 -0300 Subject: [PATCH 04/23] chore: removing crewai-tools from dev-dependencies (#1760) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As mentioned in issue #1759, listing crewai-tools as dev-dependencies makes pip install it a required dependency, and not an optional Co-authored-by: João Moura --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f9533a6f9..3f10c1a87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,6 @@ dev-dependencies = [ "mkdocs-material-extensions>=1.3.1", "pillow>=10.2.0", "cairosvg>=2.7.1", - "crewai-tools>=0.17.0", "pytest>=8.0.0", "pytest-vcr>=1.0.2", "python-dotenv>=1.0.0", From 62f3df7ed5e43dca20c19e1b2c3e9492858b1dab Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 27 Dec 2024 18:16:02 -0300 Subject: [PATCH 05/23] docs: add guide for multimodal agents (#1807) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura --- docs/how-to/multimodal-agents.mdx | 138 ++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 docs/how-to/multimodal-agents.mdx diff --git a/docs/how-to/multimodal-agents.mdx b/docs/how-to/multimodal-agents.mdx new file mode 100644 index 000000000..1dcf50d25 --- /dev/null +++ b/docs/how-to/multimodal-agents.mdx @@ -0,0 +1,138 @@ +--- +title: Using Multimodal Agents +description: Learn how to enable and use multimodal capabilities in your agents for processing images and other non-text content within the CrewAI framework. +icon: image +--- + +# Using Multimodal Agents + +CrewAI supports multimodal agents that can process both text and non-text content like images. This guide will show you how to enable and use multimodal capabilities in your agents. + +## Enabling Multimodal Capabilities + +To create a multimodal agent, simply set the `multimodal` parameter to `True` when initializing your agent: + +```python +from crewai import Agent + +agent = Agent( + role="Image Analyst", + goal="Analyze and extract insights from images", + backstory="An expert in visual content interpretation with years of experience in image analysis", + multimodal=True # This enables multimodal capabilities +) +``` + +When you set `multimodal=True`, the agent is automatically configured with the necessary tools for handling non-text content, including the `AddImageTool`. + +## Working with Images + +The multimodal agent comes pre-configured with the `AddImageTool`, which allows it to process images. You don't need to manually add this tool - it's automatically included when you enable multimodal capabilities. + +Here's a complete example showing how to use a multimodal agent to analyze an image: + +```python +from crewai import Agent, Task, Crew + +# Create a multimodal agent +image_analyst = Agent( + role="Product Analyst", + goal="Analyze product images and provide detailed descriptions", + backstory="Expert in visual product analysis with deep knowledge of design and features", + multimodal=True +) + +# Create a task for image analysis +task = Task( + description="Analyze the product image at https://example.com/product.jpg and provide a detailed description", + agent=image_analyst +) + +# Create and run the crew +crew = Crew( + agents=[image_analyst], + tasks=[task] +) + +result = crew.kickoff() +``` + +### Advanced Usage with Context + +You can provide additional context or specific questions about the image when creating tasks for multimodal agents. The task description can include specific aspects you want the agent to focus on: + +```python +from crewai import Agent, Task, Crew + +# Create a multimodal agent for detailed analysis +expert_analyst = Agent( + role="Visual Quality Inspector", + goal="Perform detailed quality analysis of product images", + backstory="Senior quality control expert with expertise in visual inspection", + multimodal=True # AddImageTool is automatically included +) + +# Create a task with specific analysis requirements +inspection_task = Task( + description=""" + Analyze the product image at https://example.com/product.jpg with focus on: + 1. Quality of materials + 2. Manufacturing defects + 3. Compliance with standards + Provide a detailed report highlighting any issues found. + """, + agent=expert_analyst +) + +# Create and run the crew +crew = Crew( + agents=[expert_analyst], + tasks=[inspection_task] +) + +result = crew.kickoff() +``` + +### Tool Details + +When working with multimodal agents, the `AddImageTool` is automatically configured with the following schema: + +```python +class AddImageToolSchema: + image_url: str # Required: The URL or path of the image to process + action: Optional[str] = None # Optional: Additional context or specific questions about the image +``` + +The multimodal agent will automatically handle the image processing through its built-in tools, allowing it to: +- Access images via URLs or local file paths +- Process image content with optional context or specific questions +- Provide analysis and insights based on the visual information and task requirements + +## Best Practices + +When working with multimodal agents, keep these best practices in mind: + +1. **Image Access** + - Ensure your images are accessible via URLs that the agent can reach + - For local images, consider hosting them temporarily or using absolute file paths + - Verify that image URLs are valid and accessible before running tasks + +2. **Task Description** + - Be specific about what aspects of the image you want the agent to analyze + - Include clear questions or requirements in the task description + - Consider using the optional `action` parameter for focused analysis + +3. **Resource Management** + - Image processing may require more computational resources than text-only tasks + - Some language models may require base64 encoding for image data + - Consider batch processing for multiple images to optimize performance + +4. **Environment Setup** + - Verify that your environment has the necessary dependencies for image processing + - Ensure your language model supports multimodal capabilities + - Test with small images first to validate your setup + +5. **Error Handling** + - Implement proper error handling for image loading failures + - Have fallback strategies for when image processing fails + - Monitor and log image processing operations for debugging From 409892d65fab88e4a390f05c46b399b5a9260463 Mon Sep 17 00:00:00 2001 From: siddharth Sambharia Date: Sat, 28 Dec 2024 02:46:47 +0530 Subject: [PATCH 06/23] Portkey Integration with CrewAI (#1233) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create Portkey-Observability-and-Guardrails.md * crewAI update with new changes * small change --------- Co-authored-by: siddharthsambharia-portkey Co-authored-by: João Moura --- .../Portkey-Observability-and-Guardrails.md | 211 ++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 docs/how-to/Portkey-Observability-and-Guardrails.md diff --git a/docs/how-to/Portkey-Observability-and-Guardrails.md b/docs/how-to/Portkey-Observability-and-Guardrails.md new file mode 100644 index 000000000..f4f7a696e --- /dev/null +++ b/docs/how-to/Portkey-Observability-and-Guardrails.md @@ -0,0 +1,211 @@ +# Portkey Integration with CrewAI +Portkey CrewAI Header Image + + +[Portkey](https://portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) is a 2-line upgrade to make your CrewAI agents reliable, cost-efficient, and fast. + +Portkey adds 4 core production capabilities to any CrewAI agent: +1. Routing to **200+ LLMs** +2. Making each LLM call more robust +3. Full-stack tracing & cost, performance analytics +4. Real-time guardrails to enforce behavior + + + + + +## Getting Started + +1. **Install Required Packages:** + +```bash +pip install -qU crewai portkey-ai +``` + +2. **Configure the LLM Client:** + +To build CrewAI Agents with Portkey, you'll need two keys: +- **Portkey API Key**: Sign up on the [Portkey app](https://app.portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) and copy your API key +- **Virtual Key**: Virtual Keys securely manage your LLM API keys in one place. Store your LLM provider API keys securely in Portkey's vault + +```python +from crewai import LLM +from portkey_ai import createHeaders, PORTKEY_GATEWAY_URL + +gpt_llm = LLM( + model="gpt-4", + base_url=PORTKEY_GATEWAY_URL, + api_key="dummy", # We are using Virtual key + extra_headers=createHeaders( + api_key="YOUR_PORTKEY_API_KEY", + virtual_key="YOUR_VIRTUAL_KEY", # Enter your Virtual key from Portkey + ) +) +``` + +3. **Create and Run Your First Agent:** + +```python +from crewai import Agent, Task, Crew + +# Define your agents with roles and goals +coder = Agent( + role='Software developer', + goal='Write clear, concise code on demand', + backstory='An expert coder with a keen eye for software trends.', + llm=gpt_llm +) + +# Create tasks for your agents +task1 = Task( + description="Define the HTML for making a simple website with heading- Hello World! Portkey is working!", + expected_output="A clear and concise HTML code", + agent=coder +) + +# Instantiate your crew +crew = Crew( + agents=[coder], + tasks=[task1], +) + +result = crew.kickoff() +print(result) +``` + + +## Key Features + +| Feature | Description | +|---------|-------------| +| 🌐 Multi-LLM Support | Access OpenAI, Anthropic, Gemini, Azure, and 250+ providers through a unified interface | +| 🛡️ Production Reliability | Implement retries, timeouts, load balancing, and fallbacks | +| 📊 Advanced Observability | Track 40+ metrics including costs, tokens, latency, and custom metadata | +| 🔍 Comprehensive Logging | Debug with detailed execution traces and function call logs | +| 🚧 Security Controls | Set budget limits and implement role-based access control | +| 🔄 Performance Analytics | Capture and analyze feedback for continuous improvement | +| 💾 Intelligent Caching | Reduce costs and latency with semantic or simple caching | + + +## Production Features with Portkey Configs + +All features mentioned below are through Portkey's Config system. Portkey's Config system allows you to define routing strategies using simple JSON objects in your LLM API calls. You can create and manage Configs directly in your code or through the Portkey Dashboard. Each Config has a unique ID for easy reference. + + + + + + +### 1. Use 250+ LLMs +Access various LLMs like Anthropic, Gemini, Mistral, Azure OpenAI, and more with minimal code changes. Switch between providers or use them together seamlessly. [Learn more about Universal API](https://portkey.ai/docs/product/ai-gateway/universal-api) + + +Easily switch between different LLM providers: + +```python +# Anthropic Configuration +anthropic_llm = LLM( + model="claude-3-5-sonnet-latest", + base_url=PORTKEY_GATEWAY_URL, + api_key="dummy", + extra_headers=createHeaders( + api_key="YOUR_PORTKEY_API_KEY", + virtual_key="YOUR_ANTHROPIC_VIRTUAL_KEY", #You don't need provider when using Virtual keys + trace_id="anthropic_agent" + ) +) + +# Azure OpenAI Configuration +azure_llm = LLM( + model="gpt-4", + base_url=PORTKEY_GATEWAY_URL, + api_key="dummy", + extra_headers=createHeaders( + api_key="YOUR_PORTKEY_API_KEY", + virtual_key="YOUR_AZURE_VIRTUAL_KEY", #You don't need provider when using Virtual keys + trace_id="azure_agent" + ) +) +``` + + +### 2. Caching +Improve response times and reduce costs with two powerful caching modes: +- **Simple Cache**: Perfect for exact matches +- **Semantic Cache**: Matches responses for requests that are semantically similar +[Learn more about Caching](https://portkey.ai/docs/product/ai-gateway/cache-simple-and-semantic) + +```py +config = { + "cache": { + "mode": "semantic", # or "simple" for exact matching + } +} +``` + +### 3. Production Reliability +Portkey provides comprehensive reliability features: +- **Automatic Retries**: Handle temporary failures gracefully +- **Request Timeouts**: Prevent hanging operations +- **Conditional Routing**: Route requests based on specific conditions +- **Fallbacks**: Set up automatic provider failovers +- **Load Balancing**: Distribute requests efficiently + +[Learn more about Reliability Features](https://portkey.ai/docs/product/ai-gateway/) + + + +### 4. Metrics + +Agent runs are complex. Portkey automatically logs **40+ comprehensive metrics** for your AI agents, including cost, tokens used, latency, etc. Whether you need a broad overview or granular insights into your agent runs, Portkey's customizable filters provide the metrics you need. + + +- Cost per agent interaction +- Response times and latency +- Token usage and efficiency +- Success/failure rates +- Cache hit rates + +Portkey Dashboard + +### 5. Detailed Logging +Logs are essential for understanding agent behavior, diagnosing issues, and improving performance. They provide a detailed record of agent activities and tool use, which is crucial for debugging and optimizing processes. + + +Access a dedicated section to view records of agent executions, including parameters, outcomes, function calls, and errors. Filter logs based on multiple parameters such as trace ID, model, tokens used, and metadata. + +
+ Traces + Portkey Traces +
+ +
+ Logs + Portkey Logs +
+ +### 6. Enterprise Security Features +- Set budget limit and rate limts per Virtual Key (disposable API keys) +- Implement role-based access control +- Track system changes with audit logs +- Configure data retention policies + + + +For detailed information on creating and managing Configs, visit the [Portkey documentation](https://docs.portkey.ai/product/ai-gateway/configs). + +## Resources + +- [📘 Portkey Documentation](https://docs.portkey.ai) +- [📊 Portkey Dashboard](https://app.portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) +- [🐦 Twitter](https://twitter.com/portkeyai) +- [💬 Discord Community](https://discord.gg/DD7vgKK299) + + + + + + + + + From 97fc44c9301f63b9756a8622cec23804e8f85491 Mon Sep 17 00:00:00 2001 From: Erick Amorim <73451993+ericklima-ca@users.noreply.github.com> Date: Fri, 27 Dec 2024 20:18:25 -0400 Subject: [PATCH 07/23] fix: Change storage initialization to None for KnowledgeStorage (#1804) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Change storage initialization to None for KnowledgeStorage * refactor: Change storage field to optional and improve error handling when saving documents --------- Co-authored-by: João Moura --- src/crewai/knowledge/knowledge.py | 4 ++-- src/crewai/knowledge/source/base_file_knowledge_source.py | 7 +++++-- src/crewai/knowledge/source/base_knowledge_source.py | 7 +++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/crewai/knowledge/knowledge.py b/src/crewai/knowledge/knowledge.py index f9f55a517..571542994 100644 --- a/src/crewai/knowledge/knowledge.py +++ b/src/crewai/knowledge/knowledge.py @@ -14,13 +14,13 @@ class Knowledge(BaseModel): Knowledge is a collection of sources and setup for the vector store to save and query relevant context. Args: sources: List[BaseKnowledgeSource] = Field(default_factory=list) - storage: KnowledgeStorage = Field(default_factory=KnowledgeStorage) + storage: Optional[KnowledgeStorage] = Field(default=None) embedder_config: Optional[Dict[str, Any]] = None """ sources: List[BaseKnowledgeSource] = Field(default_factory=list) model_config = ConfigDict(arbitrary_types_allowed=True) - storage: KnowledgeStorage = Field(default_factory=KnowledgeStorage) + storage: Optional[KnowledgeStorage] = Field(default=None) embedder_config: Optional[Dict[str, Any]] = None collection_name: Optional[str] = None diff --git a/src/crewai/knowledge/source/base_file_knowledge_source.py b/src/crewai/knowledge/source/base_file_knowledge_source.py index 8cee77e16..5743b1704 100644 --- a/src/crewai/knowledge/source/base_file_knowledge_source.py +++ b/src/crewai/knowledge/source/base_file_knowledge_source.py @@ -22,7 +22,7 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC): default_factory=list, description="The path to the file" ) content: Dict[Path, str] = Field(init=False, default_factory=dict) - storage: KnowledgeStorage = Field(default_factory=KnowledgeStorage) + storage: Optional[KnowledgeStorage] = Field(default=None) safe_file_paths: List[Path] = Field(default_factory=list) @field_validator("file_path", "file_paths", mode="before") @@ -62,7 +62,10 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC): def _save_documents(self): """Save the documents to the storage.""" - self.storage.save(self.chunks) + if self.storage: + self.storage.save(self.chunks) + else: + raise ValueError("No storage found to save documents.") def convert_to_path(self, path: Union[Path, str]) -> Path: """Convert a path to a Path object.""" diff --git a/src/crewai/knowledge/source/base_knowledge_source.py b/src/crewai/knowledge/source/base_knowledge_source.py index 88c3ab360..b558a4b9a 100644 --- a/src/crewai/knowledge/source/base_knowledge_source.py +++ b/src/crewai/knowledge/source/base_knowledge_source.py @@ -16,7 +16,7 @@ class BaseKnowledgeSource(BaseModel, ABC): chunk_embeddings: List[np.ndarray] = Field(default_factory=list) model_config = ConfigDict(arbitrary_types_allowed=True) - storage: KnowledgeStorage = Field(default_factory=KnowledgeStorage) + storage: Optional[KnowledgeStorage] = Field(default=None) metadata: Dict[str, Any] = Field(default_factory=dict) # Currently unused collection_name: Optional[str] = Field(default=None) @@ -46,4 +46,7 @@ class BaseKnowledgeSource(BaseModel, ABC): Save the documents to the storage. This method should be called after the chunks and embeddings are generated. """ - self.storage.save(self.chunks) + if self.storage: + self.storage.save(self.chunks) + else: + raise ValueError("No storage found to save documents.") From 2433819c4f56088f0f8790890887e13c4691a356 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 27 Dec 2024 21:30:39 -0300 Subject: [PATCH 08/23] fix: handle optional storage with null checks (#1808) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: João Moura --- src/crewai/knowledge/knowledge.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/crewai/knowledge/knowledge.py b/src/crewai/knowledge/knowledge.py index 571542994..c964333c8 100644 --- a/src/crewai/knowledge/knowledge.py +++ b/src/crewai/knowledge/knowledge.py @@ -49,8 +49,13 @@ class Knowledge(BaseModel): """ Query across all knowledge sources to find the most relevant information. Returns the top_k most relevant chunks. + + Raises: + ValueError: If storage is not initialized. """ - + if self.storage is None: + raise ValueError("Storage is not initialized.") + results = self.storage.search( query, limit, From 0c2d23dfe0140d9140f5406573687c9468b9c6ae Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:00:58 -0300 Subject: [PATCH 09/23] docs: update README to highlight Flows (#1809) * docs: highlight Flows feature in README Co-Authored-By: Joe Moura * docs: enhance README with LangGraph comparison and flows-crews synergy Co-Authored-By: Joe Moura * docs: replace initial Flow example with advanced Flow+Crew example; enhance LangGraph comparison Co-Authored-By: Joe Moura * docs: incorporate key terms and enhance feature descriptions Co-Authored-By: Joe Moura * docs: refine technical language, enhance feature descriptions, fix string interpolation Co-Authored-By: Joe Moura * docs: update README with performance metrics, feature enhancements, and course links Co-Authored-By: Joe Moura * docs: update LangGraph comparison with paragraph and P.S. section Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura --- README.md | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 145 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5669c71a2..2cca0f019 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # **CrewAI** -🤖 **CrewAI**: Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks. +🤖 **CrewAI**: Production-grade framework for orchestrating sophisticated AI agent systems. From simple automations to complex real-world applications, CrewAI provides precise control and deep customization. By fostering collaborative intelligence through flexible, production-ready architecture, CrewAI empowers agents to work together seamlessly, tackling complex business challenges with predictable, consistent results.

@@ -22,11 +22,13 @@ - [Why CrewAI?](#why-crewai) - [Getting Started](#getting-started) - [Key Features](#key-features) +- [Understanding Flows and Crews](#understanding-flows-and-crews) - [Examples](#examples) - [Quick Tutorial](#quick-tutorial) - [Write Job Descriptions](#write-job-descriptions) - [Trip Planner](#trip-planner) - [Stock Analysis](#stock-analysis) + - [Using Crews and Flows Together](#using-crews-and-flows-together) - [Connecting Your Crew to a Model](#connecting-your-crew-to-a-model) - [How CrewAI Compares](#how-crewai-compares) - [Contribution](#contribution) @@ -36,10 +38,40 @@ ## Why CrewAI? The power of AI collaboration has too much to offer. -CrewAI is designed to enable AI agents to assume roles, share goals, and operate in a cohesive unit - much like a well-oiled crew. Whether you're building a smart assistant platform, an automated customer service ensemble, or a multi-agent research team, CrewAI provides the backbone for sophisticated multi-agent interactions. +CrewAI is a standalone framework, built from the ground up without dependencies on Langchain or other agent frameworks. It's designed to enable AI agents to assume roles, share goals, and operate in a cohesive unit - much like a well-oiled crew. Whether you're building a smart assistant platform, an automated customer service ensemble, or a multi-agent research team, CrewAI provides the backbone for sophisticated multi-agent interactions. ## Getting Started +### Learning Resources + +Learn CrewAI through our comprehensive courses: +- [Multi AI Agent Systems with CrewAI](https://www.deeplearning.ai/short-courses/multi-ai-agent-systems-with-crewai/) - Master the fundamentals of multi-agent systems +- [Practical Multi AI Agents and Advanced Use Cases](https://www.deeplearning.ai/short-courses/practical-multi-ai-agents-and-advanced-use-cases-with-crewai/) - Deep dive into advanced implementations + +### Understanding Flows and Crews + +CrewAI offers two powerful, complementary approaches that work seamlessly together to build sophisticated AI applications: + +1. **Crews**: Teams of AI agents with true autonomy and agency, working together to accomplish complex tasks through role-based collaboration. Crews enable: + - Natural, autonomous decision-making between agents + - Dynamic task delegation and collaboration + - Specialized roles with defined goals and expertise + - Flexible problem-solving approaches + +2. **Flows**: Production-ready, event-driven workflows that deliver precise control over complex automations. Flows provide: + - Fine-grained control over execution paths for real-world scenarios + - Secure, consistent state management between tasks + - Clean integration of AI agents with production Python code + - Conditional branching for complex business logic + +The true power of CrewAI emerges when combining Crews and Flows. This synergy allows you to: +- Build complex, production-grade applications +- Balance autonomy with precise control +- Handle sophisticated real-world scenarios +- Maintain clean, maintainable code structure + +### Getting Started with Installation + To get started with CrewAI, follow these simple steps: ### 1. Installation @@ -264,13 +296,16 @@ In addition to the sequential process, you can use the hierarchical process, whi ## Key Features -- **Role-Based Agent Design**: Customize agents with specific roles, goals, and tools. -- **Autonomous Inter-Agent Delegation**: Agents can autonomously delegate tasks and inquire amongst themselves, enhancing problem-solving efficiency. -- **Flexible Task Management**: Define tasks with customizable tools and assign them to agents dynamically. -- **Processes Driven**: Currently only supports `sequential` task execution and `hierarchical` processes, but more complex processes like consensual and autonomous are being worked on. -- **Save output as file**: Save the output of individual tasks as a file, so you can use it later. -- **Parse output as Pydantic or Json**: Parse the output of individual tasks as a Pydantic model or as a Json if you want to. -- **Works with Open Source Models**: Run your crew using Open AI or open source models refer to the [Connect CrewAI to LLMs](https://docs.crewai.com/how-to/LLM-Connections/) page for details on configuring your agents' connections to models, even ones running locally! +**Note**: CrewAI is a standalone framework built from the ground up, without dependencies on Langchain or other agent frameworks. + +- **Deep Customization**: Build sophisticated agents with full control over the system - from overriding inner prompts to accessing low-level APIs. Customize roles, goals, tools, and behaviors while maintaining clean abstractions. +- **Autonomous Inter-Agent Delegation**: Agents can autonomously delegate tasks and inquire amongst themselves, enabling complex problem-solving in real-world scenarios. +- **Flexible Task Management**: Define and customize tasks with granular control, from simple operations to complex multi-step processes. +- **Production-Grade Architecture**: Support for both high-level abstractions and low-level customization, with robust error handling and state management. +- **Predictable Results**: Ensure consistent, accurate outputs through programmatic guardrails, agent training capabilities, and flow-based execution control. See our [documentation on guardrails](https://docs.crewai.com/how-to/guardrails/) for implementation details. +- **Model Flexibility**: Run your crew using OpenAI or open source models with production-ready integrations. See [Connect CrewAI to LLMs](https://docs.crewai.com/how-to/LLM-Connections/) for detailed configuration options. +- **Event-Driven Flows**: Build complex, real-world workflows with precise control over execution paths, state management, and conditional logic. +- **Process Orchestration**: Achieve any workflow pattern through flows - from simple sequential and hierarchical processes to complex, custom orchestration patterns with conditional branching and parallel execution. ![CrewAI Mind Map](./docs/crewAI-mindmap.png "CrewAI Mind Map") @@ -305,6 +340,98 @@ You can test different real life examples of AI crews in the [CrewAI-examples re [![Stock Analysis](https://img.youtube.com/vi/e0Uj4yWdaAg/maxresdefault.jpg)](https://www.youtube.com/watch?v=e0Uj4yWdaAg "Stock Analysis") +### Using Crews and Flows Together + +CrewAI's power truly shines when combining Crews with Flows to create sophisticated automation pipelines. Here's how you can orchestrate multiple Crews within a Flow: + +```python +from crewai.flow.flow import Flow, listen, start, router +from crewai import Crew, Agent, Task +from pydantic import BaseModel + +# Define structured state for precise control +class MarketState(BaseModel): + sentiment: str = "neutral" + confidence: float = 0.0 + recommendations: list = [] + +class AdvancedAnalysisFlow(Flow[MarketState]): + @start() + def fetch_market_data(self): + # Demonstrate low-level control with structured state + self.state.sentiment = "analyzing" + return {"sector": "tech", "timeframe": "1W"} # These parameters match the task description template + + @listen(fetch_market_data) + def analyze_with_crew(self, market_data): + # Show crew agency through specialized roles + analyst = Agent( + role="Senior Market Analyst", + goal="Conduct deep market analysis with expert insight", + backstory="You're a veteran analyst known for identifying subtle market patterns" + ) + researcher = Agent( + role="Data Researcher", + goal="Gather and validate supporting market data", + backstory="You excel at finding and correlating multiple data sources" + ) + + analysis_task = Task( + description="Analyze {sector} sector data for the past {timeframe}", + expected_output="Detailed market analysis with confidence score", + agent=analyst + ) + research_task = Task( + description="Find supporting data to validate the analysis", + expected_output="Corroborating evidence and potential contradictions", + agent=researcher + ) + + # Demonstrate crew autonomy + analysis_crew = Crew( + agents=[analyst, researcher], + tasks=[analysis_task, research_task], + process=Process.sequential, + verbose=True + ) + return analysis_crew.kickoff(inputs=market_data) # Pass market_data as named inputs + + @router(analyze_with_crew) + def determine_next_steps(self): + # Show flow control with conditional routing + if self.state.confidence > 0.8: + return "high_confidence" + elif self.state.confidence > 0.5: + return "medium_confidence" + return "low_confidence" + + @listen("high_confidence") + def execute_strategy(self): + # Demonstrate complex decision making + strategy_crew = Crew( + agents=[ + Agent(role="Strategy Expert", + goal="Develop optimal market strategy") + ], + tasks=[ + Task(description="Create detailed strategy based on analysis", + expected_output="Step-by-step action plan") + ] + ) + return strategy_crew.kickoff() + + @listen("medium_confidence", "low_confidence") + def request_additional_analysis(self): + self.state.recommendations.append("Gather more data") + return "Additional analysis required" +``` + +This example demonstrates how to: +1. Use Python code for basic data operations +2. Create and execute Crews as steps in your workflow +3. Use Flow decorators to manage the sequence of operations +4. Implement conditional branching based on Crew results + ## Connecting Your Crew to a Model CrewAI supports using various LLMs through a variety of connection options. By default your agents will use the OpenAI API when querying the model. However, there are several other ways to allow your agents to connect to models. For example, you can configure your agents to use a local model via the Ollama tool. @@ -313,9 +440,13 @@ Please refer to the [Connect CrewAI to LLMs](https://docs.crewai.com/how-to/LLM- ## How CrewAI Compares -**CrewAI's Advantage**: CrewAI is built with production in mind. It offers the flexibility of Autogen's conversational agents and the structured process approach of ChatDev, but without the rigidity. CrewAI's processes are designed to be dynamic and adaptable, fitting seamlessly into both development and production workflows. +**CrewAI's Advantage**: CrewAI combines autonomous agent intelligence with precise workflow control through its unique Crews and Flows architecture. The framework excels at both high-level orchestration and low-level customization, enabling complex, production-grade systems with granular control. -- **Autogen**: While Autogen does good in creating conversational agents capable of working together, it lacks an inherent concept of process. In Autogen, orchestrating agents' interactions requires additional programming, which can become complex and cumbersome as the scale of tasks grows. +- **LangGraph**: While LangGraph provides a foundation for building agent workflows, its approach requires significant boilerplate code and complex state management patterns. The framework's tight coupling with LangChain can limit flexibility when implementing custom agent behaviors or integrating with external systems. + +*P.S. CrewAI demonstrates significant performance advantages over LangGraph, executing 5.76x faster in certain cases like this QA task example ([see comparison](https://github.com/crewAIInc/crewAI-examples/tree/main/Notebooks/CrewAI%20Flows%20%26%20Langgraph/QA%20Agent)) while achieving higher evaluation scores with faster completion times in certain coding tasks, like in this example ([detailed analysis](https://github.com/crewAIInc/crewAI-examples/blob/main/Notebooks/CrewAI%20Flows%20%26%20Langgraph/Coding%20Assistant/coding_assistant_eval.ipynb)).* + +- **Autogen**: While Autogen excels at creating conversational agents capable of working together, it lacks an inherent concept of process. In Autogen, orchestrating agents' interactions requires additional programming, which can become complex and cumbersome as the scale of tasks grows. - **ChatDev**: ChatDev introduced the idea of processes into the realm of AI agents, but its implementation is quite rigid. Customizations in ChatDev are limited and not geared towards production environments, which can hinder scalability and flexibility in real-world applications. @@ -440,5 +571,8 @@ A: CrewAI uses anonymous telemetry to collect usage data for improvement purpose ### Q: Where can I find examples of CrewAI in action? A: You can find various real-life examples in the [CrewAI-examples repository](https://github.com/crewAIInc/crewAI-examples), including trip planners, stock analysis tools, and more. +### Q: What is the difference between Crews and Flows? +A: Crews and Flows serve different but complementary purposes in CrewAI. Crews are teams of AI agents working together to accomplish specific tasks through role-based collaboration, delivering accurate and predictable results. Flows, on the other hand, are event-driven workflows that can orchestrate both Crews and regular Python code, allowing you to build complex automation pipelines with secure state management and conditional execution paths. + ### Q: How can I contribute to CrewAI? A: Contributions are welcome! You can fork the repository, create a new branch for your feature, add your improvement, and send a pull request. Check the Contribution section in the README for more details. From 99fe91586d429708d0487bed4f9856e73c4a6131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Sat, 28 Dec 2024 01:03:33 -0300 Subject: [PATCH 10/23] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2cca0f019..bf1287d4d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ - [Getting Started](#getting-started) - [Key Features](#key-features) - [Understanding Flows and Crews](#understanding-flows-and-crews) +- [CrewAI vs LangGraph](#how-crewai-compares) - [Examples](#examples) - [Quick Tutorial](#quick-tutorial) - [Write Job Descriptions](#write-job-descriptions) @@ -31,6 +32,7 @@ - [Using Crews and Flows Together](#using-crews-and-flows-together) - [Connecting Your Crew to a Model](#connecting-your-crew-to-a-model) - [How CrewAI Compares](#how-crewai-compares) +- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq) - [Contribution](#contribution) - [Telemetry](#telemetry) - [License](#license) From 86f58c95deece1e7640af1a118df5d3b7bee949e Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:48:51 -0300 Subject: [PATCH 11/23] docs: add agent-specific knowledge documentation and examples (#1811) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura --- docs/concepts/knowledge.mdx | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/docs/concepts/knowledge.mdx b/docs/concepts/knowledge.mdx index 8df6f623f..8a777833e 100644 --- a/docs/concepts/knowledge.mdx +++ b/docs/concepts/knowledge.mdx @@ -171,6 +171,58 @@ crewai reset-memories --knowledge This is useful when you've updated your knowledge sources and want to ensure that the agents are using the most recent information. +## Agent-Specific Knowledge + +While knowledge can be provided at the crew level using `crew.knowledge_sources`, individual agents can also have their own knowledge sources using the `knowledge_sources` parameter: + +```python Code +from crewai import Agent, Task, Crew +from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource + +# Create agent-specific knowledge about a product +product_specs = StringKnowledgeSource( + content="""The XPS 13 laptop features: + - 13.4-inch 4K display + - Intel Core i7 processor + - 16GB RAM + - 512GB SSD storage + - 12-hour battery life""", + metadata={"category": "product_specs"} +) + +# Create a support agent with product knowledge +support_agent = Agent( + role="Technical Support Specialist", + goal="Provide accurate product information and support.", + backstory="You are an expert on our laptop products and specifications.", + knowledge_sources=[product_specs] # Agent-specific knowledge +) + +# Create a task that requires product knowledge +support_task = Task( + description="Answer this customer question: {question}", + agent=support_agent +) + +# Create and run the crew +crew = Crew( + agents=[support_agent], + tasks=[support_task] +) + +# Get answer about the laptop's specifications +result = crew.kickoff( + inputs={"question": "What is the storage capacity of the XPS 13?"} +) +``` + + + Benefits of agent-specific knowledge: + - Give agents specialized information for their roles + - Maintain separation of concerns between agents + - Combine with crew-level knowledge for layered information access + + ## Custom Knowledge Sources CrewAI allows you to create custom knowledge sources for any type of data by extending the `BaseKnowledgeSource` class. Let's create a practical example that fetches and processes space news articles. From a0c322a53552eee27a9a8c752bffaf5928aefa3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Sat, 28 Dec 2024 02:04:00 -0300 Subject: [PATCH 12/23] fixing file paths for knowledge source --- .../source/base_file_knowledge_source.py | 5 ++-- tests/knowledge/knowledge_test.py | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/crewai/knowledge/source/base_file_knowledge_source.py b/src/crewai/knowledge/source/base_file_knowledge_source.py index 5743b1704..ac345b6a6 100644 --- a/src/crewai/knowledge/source/base_file_knowledge_source.py +++ b/src/crewai/knowledge/source/base_file_knowledge_source.py @@ -26,9 +26,10 @@ class BaseFileKnowledgeSource(BaseKnowledgeSource, ABC): safe_file_paths: List[Path] = Field(default_factory=list) @field_validator("file_path", "file_paths", mode="before") - def validate_file_path(cls, v, values): + def validate_file_path(cls, v, info): """Validate that at least one of file_path or file_paths is provided.""" - if v is None and ("file_path" not in values or values.get("file_path") is None): + # Single check if both are None, O(1) instead of nested conditions + if v is None and info.data.get("file_path" if info.field_name == "file_paths" else "file_paths") is None: raise ValueError("Either file_path or file_paths must be provided") return v diff --git a/tests/knowledge/knowledge_test.py b/tests/knowledge/knowledge_test.py index 366067587..6704d3031 100644 --- a/tests/knowledge/knowledge_test.py +++ b/tests/knowledge/knowledge_test.py @@ -584,3 +584,28 @@ def test_docling_source_with_local_file(): docling_source = CrewDoclingSource(file_paths=[pdf_path]) assert docling_source.file_paths == [pdf_path] assert docling_source.content is not None + + +def test_file_path_validation(): + """Test file path validation for knowledge sources.""" + current_dir = Path(__file__).parent + pdf_path = current_dir / "crewai_quickstart.pdf" + + # Test valid single file_path + source = PDFKnowledgeSource(file_path=pdf_path) + assert source.safe_file_paths == [pdf_path] + + # Test valid file_paths list + source = PDFKnowledgeSource(file_paths=[pdf_path]) + assert source.safe_file_paths == [pdf_path] + + # Test both file_path and file_paths provided (should use file_paths) + source = PDFKnowledgeSource(file_path=pdf_path, file_paths=[pdf_path]) + assert source.safe_file_paths == [pdf_path] + + # Test neither file_path nor file_paths provided + with pytest.raises( + ValueError, + match="file_path/file_paths must be a Path, str, or a list of these types" + ): + PDFKnowledgeSource() From 73f328860b4a477a6d3736e646783d7493841cb4 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 29 Dec 2024 01:57:59 -0300 Subject: [PATCH 13/23] Fix interpolation for output_file in Task (#1803) (#1814) * fix: interpolate output_file attribute from YAML Co-Authored-By: Joe Moura * fix: add security validation for output_file paths Co-Authored-By: Joe Moura * fix: add _original_output_file private attribute to fix type-checker error Co-Authored-By: Joe Moura * fix: update interpolate_only to handle None inputs and remove duplicate attribute Co-Authored-By: Joe Moura * fix: improve output_file validation and error messages Co-Authored-By: Joe Moura * test: add end-to-end tests for output_file functionality Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura --- src/crewai/task.py | 123 ++++++++- .../test_crew_output_file_end_to_end.yaml | 243 ++++++++++++++++++ tests/crew_test.py | 86 ++++++- tests/task_test.py | 65 ++++- 4 files changed, 503 insertions(+), 14 deletions(-) create mode 100644 tests/cassettes/test_crew_output_file_end_to_end.yaml diff --git a/src/crewai/task.py b/src/crewai/task.py index 30ab79c00..a63bde57d 100644 --- a/src/crewai/task.py +++ b/src/crewai/task.py @@ -179,6 +179,7 @@ class Task(BaseModel): _execution_span: Optional[Span] = PrivateAttr(default=None) _original_description: Optional[str] = PrivateAttr(default=None) _original_expected_output: Optional[str] = PrivateAttr(default=None) + _original_output_file: Optional[str] = PrivateAttr(default=None) _thread: Optional[threading.Thread] = PrivateAttr(default=None) _execution_time: Optional[float] = PrivateAttr(default=None) @@ -213,8 +214,46 @@ class Task(BaseModel): @field_validator("output_file") @classmethod - def output_file_validation(cls, value: str) -> str: - """Validate the output file path by removing the / from the beginning of the path.""" + def output_file_validation(cls, value: Optional[str]) -> Optional[str]: + """Validate the output file path. + + Args: + value: The output file path to validate. Can be None or a string. + If the path contains template variables (e.g. {var}), leading slashes are preserved. + For regular paths, leading slashes are stripped. + + Returns: + The validated and potentially modified path, or None if no path was provided. + + Raises: + ValueError: If the path contains invalid characters, path traversal attempts, + or other security concerns. + """ + if value is None: + return None + + # Basic security checks + if ".." in value: + raise ValueError("Path traversal attempts are not allowed in output_file paths") + + # Check for shell expansion first + if value.startswith('~') or value.startswith('$'): + raise ValueError("Shell expansion characters are not allowed in output_file paths") + + # Then check other shell special characters + if any(char in value for char in ['|', '>', '<', '&', ';']): + raise ValueError("Shell special characters are not allowed in output_file paths") + + # Don't strip leading slash if it's a template path with variables + if "{" in value or "}" in value: + # Validate template variable format + template_vars = [part.split("}")[0] for part in value.split("{")[1:]] + for var in template_vars: + if not var.isidentifier(): + raise ValueError(f"Invalid template variable name: {var}") + return value + + # Strip leading slash for regular paths if value.startswith("/"): return value[1:] return value @@ -393,27 +432,89 @@ class Task(BaseModel): tasks_slices = [self.description, output] return "\n".join(tasks_slices) - def interpolate_inputs(self, inputs: Dict[str, Any]) -> None: - """Interpolate inputs into the task description and expected output.""" + def interpolate_inputs(self, inputs: Dict[str, Union[str, int, float]]) -> None: + """Interpolate inputs into the task description, expected output, and output file path. + + Args: + inputs: Dictionary mapping template variables to their values. + Supported value types are strings, integers, and floats. + + Raises: + ValueError: If a required template variable is missing from inputs. + """ if self._original_description is None: self._original_description = self.description if self._original_expected_output is None: self._original_expected_output = self.expected_output + if self.output_file is not None and self._original_output_file is None: + self._original_output_file = self.output_file - if inputs: + if not inputs: + return + + try: self.description = self._original_description.format(**inputs) + except KeyError as e: + raise ValueError(f"Missing required template variable '{e.args[0]}' in description") from e + except ValueError as e: + raise ValueError(f"Error interpolating description: {str(e)}") from e + + try: self.expected_output = self.interpolate_only( input_string=self._original_expected_output, inputs=inputs ) + except (KeyError, ValueError) as e: + raise ValueError(f"Error interpolating expected_output: {str(e)}") from e - def interpolate_only(self, input_string: str, inputs: Dict[str, Any]) -> str: - """Interpolate placeholders (e.g., {key}) in a string while leaving JSON untouched.""" - escaped_string = input_string.replace("{", "{{").replace("}", "}}") + if self.output_file is not None: + try: + self.output_file = self.interpolate_only( + input_string=self._original_output_file, inputs=inputs + ) + except (KeyError, ValueError) as e: + raise ValueError(f"Error interpolating output_file path: {str(e)}") from e - for key in inputs.keys(): - escaped_string = escaped_string.replace(f"{{{{{key}}}}}", f"{{{key}}}") + def interpolate_only(self, input_string: Optional[str], inputs: Dict[str, Union[str, int, float]]) -> str: + """Interpolate placeholders (e.g., {key}) in a string while leaving JSON untouched. + + Args: + input_string: The string containing template variables to interpolate. + Can be None or empty, in which case an empty string is returned. + inputs: Dictionary mapping template variables to their values. + Supported value types are strings, integers, and floats. + If input_string is empty or has no placeholders, inputs can be empty. + + Returns: + The interpolated string with all template variables replaced with their values. + Empty string if input_string is None or empty. + + Raises: + ValueError: If a required template variable is missing from inputs. + KeyError: If a template variable is not found in the inputs dictionary. + """ + if input_string is None or not input_string: + return "" + if "{" not in input_string and "}" not in input_string: + return input_string + if not inputs: + raise ValueError("Inputs dictionary cannot be empty when interpolating variables") - return escaped_string.format(**inputs) + try: + # Validate input types + for key, value in inputs.items(): + if not isinstance(value, (str, int, float)): + raise ValueError(f"Value for key '{key}' must be a string, integer, or float, got {type(value).__name__}") + + escaped_string = input_string.replace("{", "{{").replace("}", "}}") + + for key in inputs.keys(): + escaped_string = escaped_string.replace(f"{{{{{key}}}}}", f"{{{key}}}") + + return escaped_string.format(**inputs) + except KeyError as e: + raise KeyError(f"Template variable '{e.args[0]}' not found in inputs dictionary") from e + except ValueError as e: + raise ValueError(f"Error during string interpolation: {str(e)}") from e def increment_tools_errors(self) -> None: """Increment the tools errors counter.""" diff --git a/tests/cassettes/test_crew_output_file_end_to_end.yaml b/tests/cassettes/test_crew_output_file_end_to_end.yaml new file mode 100644 index 000000000..2cbd6d9c3 --- /dev/null +++ b/tests/cassettes/test_crew_output_file_end_to_end.yaml @@ -0,0 +1,243 @@ +interactions: +- request: + body: !!binary | + CuIcCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSuRwKEgoQY3Jld2FpLnRl + bGVtZXRyeRKjBwoQXK7w4+uvyEkrI9D5qyvcJxII5UmQ7hmczdIqDENyZXcgQ3JlYXRlZDABOfxQ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jNmEwZWMy + MWYzOCIsICJhc3luY19leGVjdXRpb24/IjogZmFsc2UsICJodW1hbl9pbnB1dD8iOiBmYWxzZSwg + ImFnZW50X3JvbGUiOiAiUmVzZWFyY2hlciIsICJhZ2VudF9rZXkiOiAiYjU5Y2Y3N2I2ZTc2NTg0 + ODcwZWIxYzM4ODIzZDdlMjgiLCAidG9vbHNfbmFtZXMiOiBbXX1degIYAYUBAAEAABKOAgoQyYfi + Ftim717svttBZY3p5hIIUxR5bBHzWWkqDFRhc2sgQ3JlYXRlZDABOV4OBiA4jBUYQbLjBiA4jBUY + Si4KCGNyZXdfa2V5EiIKIGI2NzM2ODZmYzgyMmMyMDNjN2U4NzljNjc1NDI0Njk5SjEKB2NyZXdf + aWQSJgokZjJhZWVhNjMtNTY5ZS00NTM1LWJlNjQtNGJmNjNmZTk2OGM3Si4KCHRhc2tfa2V5EiIK + IGE1ZTVjNThjZWExYjlkMDAzMzJlNjg0NDFkMzI3YmRmSjEKB3Rhc2tfaWQSJgokMGI5NGIxNjQt + Mzk1OS00YWZhLTk2ODgtYmM2YTBlYzIxZjM4egIYAYUBAAEAAA== + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '3685' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.27.0 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Sun, 29 Dec 2024 04:43:27 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are Researcher. You have + extensive AI research experience.\nYour personal goal is: Analyze AI topics\nTo + give my best complete final answer to the task use the exact following format:\n\nThought: + I now can give a great answer\nFinal Answer: Your final answer must be the great + and the most complete as possible, it must be outcome described.\n\nI MUST use + these formats, my job depends on it!"}, {"role": "user", "content": "\nCurrent + Task: Explain the advantages of AI.\n\nThis is the expect criteria for your + final answer: A summary of the main advantages, bullet points recommended.\nyou + MUST return the actual complete content as the final answer, not a summary.\n\nBegin! + This is VERY important to you, use the tools available and give your best Final + Answer, your job depends on it!\n\nThought:"}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"], "stream": false}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '922' + content-type: + - application/json + cookie: + - _cfuvid=eff7OIkJ0zWRunpA6z67LHqscmSe6XjNxXiPw1R3xCc-1733770413538-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.52.1 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.52.1 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-AjfR6FDuTw7NGzy8w7sxjvOkUQlru\",\n \"object\": + \"chat.completion\",\n \"created\": 1735447404,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"I now can give a great answer \\nFinal + Answer: \\n**Advantages of AI** \\n\\n1. **Increased Efficiency and Productivity** + \ \\n - AI systems can process large amounts of data quickly and accurately, + leading to faster decision-making and increased productivity in various sectors.\\n\\n2. + **Cost Savings** \\n - Automation of repetitive and time-consuming tasks + reduces labor costs and increases operational efficiency, allowing businesses + to allocate resources more effectively.\\n\\n3. **Enhanced Data Analysis** \\n + \ - AI excels at analyzing big data, identifying patterns, and providing insights + that support better strategic planning and business decision-making.\\n\\n4. + **24/7 Availability** \\n - AI solutions, such as chatbots and virtual assistants, + operate continuously without breaks, offering constant support and customer + service, enhancing user experience.\\n\\n5. **Personalization** \\n - AI + enables the customization of content, products, and services based on user preferences + and behaviors, leading to improved customer satisfaction and loyalty.\\n\\n6. + **Improved Accuracy** \\n - AI technologies, such as machine learning algorithms, + reduce the likelihood of human error in various processes, leading to greater + accuracy and reliability.\\n\\n7. **Enhanced Innovation** \\n - AI fosters + innovative solutions by providing new tools and approaches to problem-solving, + enabling companies to develop cutting-edge products and services.\\n\\n8. **Scalability** + \ \\n - AI can be scaled to handle varying amounts of workloads without significant + changes to infrastructure, making it easier for organizations to expand operations.\\n\\n9. + **Predictive Capabilities** \\n - Advanced analytics powered by AI can anticipate + trends and outcomes, allowing businesses to proactively adjust strategies and + improve forecasting.\\n\\n10. **Health Benefits** \\n - In healthcare, AI + assists in diagnostics, personalized treatment plans, and predictive analytics, + leading to better patient care and improved health outcomes.\\n\\n11. **Safety + and Risk Mitigation** \\n - AI can enhance safety in various industries + by taking over dangerous tasks, monitoring for hazards, and predicting maintenance + needs for critical machinery, thereby preventing accidents.\\n\\n12. **Reduced + Environmental Impact** \\n - AI can optimize resource usage in areas such + as energy consumption and supply chain logistics, contributing to sustainability + efforts and reducing overall environmental footprints.\",\n \"refusal\": + null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 168,\n \"completion_tokens\": + 440,\n \"total_tokens\": 608,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"system_fingerprint\": + \"fp_0aa8d3e20b\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8f9721053d1eb9f1-SEA + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 29 Dec 2024 04:43:32 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=5enubNIoQSGMYEgy8Q2FpzzhphA0y.0lXukRZrWFvMk-1735447412-1.0.1.1-FIK1sMkUl3YnW1gTC6ftDtb2mKsbosb4mwabdFAlWCfJ6pXeavYq.bPsfKNvzAb5WYq60yVGH5lHsJT05bhSgw; + path=/; expires=Sun, 29-Dec-24 05:13:32 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=63wmKMTuFamkLN8FBI4fP8JZWbjWiRxWm7wb3kz.z_A-1735447412038-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '7577' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999793' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_55b8d714656e8f10f4e23cbe9034d66b + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/crew_test.py b/tests/crew_test.py index 2003ddada..74bcf08d3 100644 --- a/tests/crew_test.py +++ b/tests/crew_test.py @@ -1941,6 +1941,90 @@ def test_crew_log_file_output(tmp_path): assert test_file.exists() +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_crew_output_file_end_to_end(tmp_path): + """Test output file functionality in a full crew context.""" + # Create an agent + agent = Agent( + role="Researcher", + goal="Analyze AI topics", + backstory="You have extensive AI research experience.", + allow_delegation=False, + ) + + # Create a task with dynamic output file path + dynamic_path = tmp_path / "output_{topic}.txt" + task = Task( + description="Explain the advantages of {topic}.", + expected_output="A summary of the main advantages, bullet points recommended.", + agent=agent, + output_file=str(dynamic_path), + ) + + # Create and run the crew + crew = Crew( + agents=[agent], + tasks=[task], + process=Process.sequential, + ) + crew.kickoff(inputs={"topic": "AI"}) + + # Verify file creation and cleanup + expected_file = tmp_path / "output_AI.txt" + assert expected_file.exists(), f"Output file {expected_file} was not created" + + +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_crew_output_file_validation_failures(): + """Test output file validation failures in a crew context.""" + agent = Agent( + role="Researcher", + goal="Analyze data", + backstory="You analyze data files.", + allow_delegation=False, + ) + + # Test path traversal + with pytest.raises(ValueError, match="Path traversal"): + task = Task( + description="Analyze data", + expected_output="Analysis results", + agent=agent, + output_file="../output.txt" + ) + Crew(agents=[agent], tasks=[task]).kickoff() + + # Test shell special characters + with pytest.raises(ValueError, match="Shell special characters"): + task = Task( + description="Analyze data", + expected_output="Analysis results", + agent=agent, + output_file="output.txt | rm -rf /" + ) + Crew(agents=[agent], tasks=[task]).kickoff() + + # Test shell expansion + with pytest.raises(ValueError, match="Shell expansion"): + task = Task( + description="Analyze data", + expected_output="Analysis results", + agent=agent, + output_file="~/output.txt" + ) + Crew(agents=[agent], tasks=[task]).kickoff() + + # Test invalid template variable + with pytest.raises(ValueError, match="Invalid template variable"): + task = Task( + description="Analyze data", + expected_output="Analysis results", + agent=agent, + output_file="{invalid-name}/output.txt" + ) + Crew(agents=[agent], tasks=[task]).kickoff() + + @pytest.mark.vcr(filter_headers=["authorization"]) def test_manager_agent(): from unittest.mock import patch @@ -3125,4 +3209,4 @@ def test_multimodal_agent_live_image_analysis(): # Verify we got a meaningful response assert isinstance(result.raw, str) assert len(result.raw) > 100 # Expecting a detailed analysis - assert "error" not in result.raw.lower() # No error messages in response \ No newline at end of file + assert "error" not in result.raw.lower() # No error messages in response diff --git a/tests/task_test.py b/tests/task_test.py index 40eb98e54..dc15c251f 100644 --- a/tests/task_test.py +++ b/tests/task_test.py @@ -719,21 +719,24 @@ def test_interpolate_inputs(): task = Task( description="Give me a list of 5 interesting ideas about {topic} to explore for an article, what makes them unique and interesting.", expected_output="Bullet point list of 5 interesting ideas about {topic}.", + output_file="/tmp/{topic}/output_{date}.txt" ) - task.interpolate_inputs(inputs={"topic": "AI"}) + task.interpolate_inputs(inputs={"topic": "AI", "date": "2024"}) assert ( task.description == "Give me a list of 5 interesting ideas about AI to explore for an article, what makes them unique and interesting." ) assert task.expected_output == "Bullet point list of 5 interesting ideas about AI." + assert task.output_file == "/tmp/AI/output_2024.txt" - task.interpolate_inputs(inputs={"topic": "ML"}) + task.interpolate_inputs(inputs={"topic": "ML", "date": "2025"}) assert ( task.description == "Give me a list of 5 interesting ideas about ML to explore for an article, what makes them unique and interesting." ) assert task.expected_output == "Bullet point list of 5 interesting ideas about ML." + assert task.output_file == "/tmp/ML/output_2025.txt" def test_interpolate_only(): @@ -872,3 +875,61 @@ def test_key(): assert ( task.key == hash ), "The key should be the hash of the non-interpolated description." + + +def test_output_file_validation(): + """Test output file path validation.""" + # Valid paths + assert Task( + description="Test task", + expected_output="Test output", + output_file="output.txt" + ).output_file == "output.txt" + assert Task( + description="Test task", + expected_output="Test output", + output_file="/tmp/output.txt" + ).output_file == "tmp/output.txt" + assert Task( + description="Test task", + expected_output="Test output", + output_file="{dir}/output_{date}.txt" + ).output_file == "{dir}/output_{date}.txt" + + # Invalid paths + with pytest.raises(ValueError, match="Path traversal"): + Task( + description="Test task", + expected_output="Test output", + output_file="../output.txt" + ) + with pytest.raises(ValueError, match="Path traversal"): + Task( + description="Test task", + expected_output="Test output", + output_file="folder/../output.txt" + ) + with pytest.raises(ValueError, match="Shell special characters"): + Task( + description="Test task", + expected_output="Test output", + output_file="output.txt | rm -rf /" + ) + with pytest.raises(ValueError, match="Shell expansion"): + Task( + description="Test task", + expected_output="Test output", + output_file="~/output.txt" + ) + with pytest.raises(ValueError, match="Shell expansion"): + Task( + description="Test task", + expected_output="Test output", + output_file="$HOME/output.txt" + ) + with pytest.raises(ValueError, match="Invalid template variable"): + Task( + description="Test task", + expected_output="Test output", + output_file="{invalid-name}/output.txt" + ) From d85898cf29ca6f67fbf3d14e06bbd075309b308a Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 16:58:18 -0300 Subject: [PATCH 14/23] fix(manager_llm): handle coworker role name case/whitespace properly (#1820) * fix(manager_llm): handle coworker role name case/whitespace properly - Add .strip() to agent name and role comparisons in base_agent_tools.py - Add test case for varied role name cases and whitespace - Fix issue #1503 with manager LLM delegation Co-Authored-By: Joe Moura * fix(manager_llm): improve error handling and add debug logging - Add debug logging for better observability - Add sanitize_agent_name helper method - Enhance error messages with more context - Add parameterized tests for edge cases: - Embedded quotes - Trailing newlines - Multiple whitespace - Case variations - None values - Improve error handling with specific exceptions Co-Authored-By: Joe Moura * style: fix import sorting in base_agent_tools and test_manager_llm_delegation Co-Authored-By: Joe Moura * fix(manager_llm): improve whitespace normalization in role name matching Co-Authored-By: Joe Moura * style: fix import sorting in base_agent_tools and test_manager_llm_delegation Co-Authored-By: Joe Moura * fix(manager_llm): add error message template for agent tool execution errors Co-Authored-By: Joe Moura * style: fix import sorting in test_manager_llm_delegation.py Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura --- .../tools/agent_tools/base_agent_tools.py | 86 +++++++++++++++---- src/crewai/translations/en.json | 3 +- tests/crew_test.py | 65 ++++++++++++++ tests/test_manager_llm_delegation.py | 55 ++++++++++++ 4 files changed, 193 insertions(+), 16 deletions(-) create mode 100644 tests/test_manager_llm_delegation.py diff --git a/src/crewai/tools/agent_tools/base_agent_tools.py b/src/crewai/tools/agent_tools/base_agent_tools.py index ea63dd51e..e67dce72a 100644 --- a/src/crewai/tools/agent_tools/base_agent_tools.py +++ b/src/crewai/tools/agent_tools/base_agent_tools.py @@ -1,3 +1,4 @@ +import logging from typing import Optional, Union from pydantic import Field @@ -7,6 +8,8 @@ from crewai.task import Task from crewai.tools.base_tool import BaseTool from crewai.utilities import I18N +logger = logging.getLogger(__name__) + class BaseAgentTool(BaseTool): """Base class for agent-related tools""" @@ -16,6 +19,25 @@ class BaseAgentTool(BaseTool): default_factory=I18N, description="Internationalization settings" ) + def sanitize_agent_name(self, name: str) -> str: + """ + Sanitize agent role name by normalizing whitespace and setting to lowercase. + Converts all whitespace (including newlines) to single spaces and removes quotes. + + Args: + name (str): The agent role name to sanitize + + Returns: + str: The sanitized agent role name, with whitespace normalized, + converted to lowercase, and quotes removed + """ + if not name: + return "" + # Normalize all whitespace (including newlines) to single spaces + normalized = " ".join(name.split()) + # Remove quotes and convert to lowercase + return normalized.replace('"', "").casefold() + def _get_coworker(self, coworker: Optional[str], **kwargs) -> Optional[str]: coworker = coworker or kwargs.get("co_worker") or kwargs.get("coworker") if coworker: @@ -25,11 +47,27 @@ class BaseAgentTool(BaseTool): return coworker def _execute( - self, agent_name: Union[str, None], task: str, context: Union[str, None] + self, + agent_name: Optional[str], + task: str, + context: Optional[str] = None ) -> str: + """ + Execute delegation to an agent with case-insensitive and whitespace-tolerant matching. + + Args: + agent_name: Name/role of the agent to delegate to (case-insensitive) + task: The specific question or task to delegate + context: Optional additional context for the task execution + + Returns: + str: The execution result from the delegated agent or an error message + if the agent cannot be found + """ try: if agent_name is None: agent_name = "" + logger.debug("No agent name provided, using empty string") # It is important to remove the quotes from the agent name. # The reason we have to do this is because less-powerful LLM's @@ -38,31 +76,49 @@ class BaseAgentTool(BaseTool): # {"task": "....", "coworker": ".... # when it should look like this: # {"task": "....", "coworker": "...."} - agent_name = agent_name.casefold().replace('"', "").replace("\n", "") + sanitized_name = self.sanitize_agent_name(agent_name) + logger.debug(f"Sanitized agent name from '{agent_name}' to '{sanitized_name}'") + + available_agents = [agent.role for agent in self.agents] + logger.debug(f"Available agents: {available_agents}") + agent = [ # type: ignore # Incompatible types in assignment (expression has type "list[BaseAgent]", variable has type "str | None") available_agent for available_agent in self.agents - if available_agent.role.casefold().replace("\n", "") == agent_name + if self.sanitize_agent_name(available_agent.role) == sanitized_name ] - except Exception as _: + logger.debug(f"Found {len(agent)} matching agents for role '{sanitized_name}'") + except (AttributeError, ValueError) as e: + # Handle specific exceptions that might occur during role name processing return self.i18n.errors("agent_tool_unexisting_coworker").format( coworkers="\n".join( - [f"- {agent.role.casefold()}" for agent in self.agents] - ) + [f"- {self.sanitize_agent_name(agent.role)}" for agent in self.agents] + ), + error=str(e) ) if not agent: + # No matching agent found after sanitization return self.i18n.errors("agent_tool_unexisting_coworker").format( coworkers="\n".join( - [f"- {agent.role.casefold()}" for agent in self.agents] - ) + [f"- {self.sanitize_agent_name(agent.role)}" for agent in self.agents] + ), + error=f"No agent found with role '{sanitized_name}'" ) agent = agent[0] - task_with_assigned_agent = Task( # type: ignore # Incompatible types in assignment (expression has type "Task", variable has type "str") - description=task, - agent=agent, - expected_output=agent.i18n.slice("manager_request"), - i18n=agent.i18n, - ) - return agent.execute_task(task_with_assigned_agent, context) + try: + task_with_assigned_agent = Task( + description=task, + agent=agent, + expected_output=agent.i18n.slice("manager_request"), + i18n=agent.i18n, + ) + logger.debug(f"Created task for agent '{self.sanitize_agent_name(agent.role)}': {task}") + return agent.execute_task(task_with_assigned_agent, context) + except Exception as e: + # Handle task creation or execution errors + return self.i18n.errors("agent_tool_execution_error").format( + agent_role=self.sanitize_agent_name(agent.role), + error=str(e) + ) diff --git a/src/crewai/translations/en.json b/src/crewai/translations/en.json index 12850c9e2..a1ea30436 100644 --- a/src/crewai/translations/en.json +++ b/src/crewai/translations/en.json @@ -33,7 +33,8 @@ "tool_usage_error": "I encountered an error: {error}", "tool_arguments_error": "Error: the Action Input is not a valid key, value dictionary.", "wrong_tool_name": "You tried to use the tool {tool}, but it doesn't exist. You must use one of the following tools, use one at time: {tools}.", - "tool_usage_exception": "I encountered an error while trying to use the tool. This was the error: {error}.\n Tool {tool} accepts these inputs: {tool_inputs}" + "tool_usage_exception": "I encountered an error while trying to use the tool. This was the error: {error}.\n Tool {tool} accepts these inputs: {tool_inputs}", + "agent_tool_execution_error": "Error executing task with agent '{agent_role}'. Error: {error}" }, "tools": { "delegate_work": "Delegate a specific task to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the task you want them to do, and ALL necessary context to execute the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them.", diff --git a/tests/crew_test.py b/tests/crew_test.py index 74bcf08d3..0cb8f469c 100644 --- a/tests/crew_test.py +++ b/tests/crew_test.py @@ -391,6 +391,71 @@ def test_manager_agent_delegating_to_all_agents(): ) +@pytest.mark.vcr(filter_headers=["authorization"]) +def test_manager_agent_delegates_with_varied_role_cases(): + """ + Test that the manager agent can delegate to agents regardless of case or whitespace variations in role names. + This test verifies the fix for issue #1503 where role matching was too strict. + """ + # Create agents with varied case and whitespace in roles + researcher_spaced = Agent( + role=" Researcher ", # Extra spaces + goal="Research with spaces in role", + backstory="A researcher with spaces in role name", + allow_delegation=False, + ) + + writer_caps = Agent( + role="SENIOR WRITER", # All caps + goal="Write with caps in role", + backstory="A writer with caps in role name", + allow_delegation=False, + ) + + task = Task( + description="Research and write about AI. The researcher should do the research, and the writer should write it up.", + expected_output="A well-researched article about AI.", + agent=researcher_spaced, # Assign to researcher with spaces + ) + + crew = Crew( + agents=[researcher_spaced, writer_caps], + process=Process.hierarchical, + manager_llm="gpt-4o", + tasks=[task], + ) + + mock_task_output = TaskOutput( + description="Mock description", + raw="mocked output", + agent="mocked agent" + ) + task.output = mock_task_output + + with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + crew.kickoff() + + # Verify execute_sync was called once + mock_execute_sync.assert_called_once() + + # Get the tools argument from the call + _, kwargs = mock_execute_sync.call_args + tools = kwargs['tools'] + + # Verify the delegation tools were passed correctly and can handle case/whitespace variations + assert len(tools) == 2 + + # Check delegation tool descriptions (should work despite case/whitespace differences) + delegation_tool = tools[0] + question_tool = tools[1] + + assert "Delegate a specific task to one of the following coworkers:" in delegation_tool.description + assert " Researcher " in delegation_tool.description or "SENIOR WRITER" in delegation_tool.description + + assert "Ask a specific question to one of the following coworkers:" in question_tool.description + assert " Researcher " in question_tool.description or "SENIOR WRITER" in question_tool.description + + @pytest.mark.vcr(filter_headers=["authorization"]) def test_crew_with_delegating_agents(): tasks = [ diff --git a/tests/test_manager_llm_delegation.py b/tests/test_manager_llm_delegation.py new file mode 100644 index 000000000..d1f2068e4 --- /dev/null +++ b/tests/test_manager_llm_delegation.py @@ -0,0 +1,55 @@ +from unittest.mock import MagicMock + +import pytest + +from crewai import Agent, Task +from crewai.tools.agent_tools.base_agent_tools import BaseAgentTool + + +class TestAgentTool(BaseAgentTool): + """Concrete implementation of BaseAgentTool for testing.""" + def _run(self, *args, **kwargs): + """Implement required _run method.""" + return "Test response" + +@pytest.mark.parametrize("role_name,should_match", [ + ('Futel Official Infopoint', True), # exact match + (' "Futel Official Infopoint" ', True), # extra quotes and spaces + ('Futel Official Infopoint\n', True), # trailing newline + ('"Futel Official Infopoint"', True), # embedded quotes + (' FUTEL\nOFFICIAL INFOPOINT ', True), # multiple whitespace and newline + ('futel official infopoint', True), # lowercase + ('FUTEL OFFICIAL INFOPOINT', True), # uppercase + ('Non Existent Agent', False), # non-existent agent + (None, False), # None agent name +]) +def test_agent_tool_role_matching(role_name, should_match): + """Test that agent tools can match roles regardless of case, whitespace, and special characters.""" + # Create test agent + test_agent = Agent( + role='Futel Official Infopoint', + goal='Answer questions about Futel', + backstory='Futel Football Club info', + allow_delegation=False + ) + + # Create test agent tool + agent_tool = TestAgentTool( + name="test_tool", + description="Test tool", + agents=[test_agent] + ) + + # Test role matching + result = agent_tool._execute( + agent_name=role_name, + task='Test task', + context=None + ) + + if should_match: + assert "coworker mentioned not found" not in result.lower(), \ + f"Should find agent with role name: {role_name}" + else: + assert "coworker mentioned not found" in result.lower(), \ + f"Should not find agent with role name: {role_name}" From ba0965ef874eee958b8cb4cc091f23416ba3c9fb Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 17:10:56 -0300 Subject: [PATCH 15/23] fix: add tiktoken as explicit dependency and document Rust requirement (#1826) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add tiktoken as explicit dependency and document Rust requirement - Add tiktoken>=0.8.0 as explicit dependency to ensure pre-built wheels are used - Document Rust compiler requirement as fallback in README.md - Addresses issue #1824 tiktoken build failure Co-Authored-By: Joe Moura * fix: adjust tiktoken version to ~=0.7.0 for dependency compatibility - Update tiktoken dependency to ~=0.7.0 to resolve conflict with embedchain - Maintain compatibility with crewai-tools dependency chain - Addresses CI build failures Co-Authored-By: Joe Moura * docs: add troubleshooting section and make tiktoken optional Co-Authored-By: Joe Moura * Update README.md --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura Co-authored-by: João Moura --- README.md | 17 ++++++++++++++++- pyproject.toml | 32 +++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index bf1287d4d..edcbb6f51 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,6 @@ First, install CrewAI: ```shell pip install crewai ``` - If you want to install the 'crewai' package along with its optional features that include additional tools for agents, you can do so by using the following command: ```shell @@ -93,6 +92,22 @@ pip install 'crewai[tools]' ``` The command above installs the basic package and also adds extra components which require more dependencies to function. +### Troubleshooting Dependencies + +If you encounter issues during installation or usage, here are some common solutions: + +#### Common Issues + +1. **ModuleNotFoundError: No module named 'tiktoken'** + - Install tiktoken explicitly: `pip install 'crewai[embeddings]'` + - If using embedchain or other tools: `pip install 'crewai[tools]'` + +2. **Failed building wheel for tiktoken** + - Ensure Rust compiler is installed (see installation steps above) + - For Windows: Verify Visual C++ Build Tools are installed + - Try upgrading pip: `pip install --upgrade pip` + - If issues persist, use a pre-built wheel: `pip install tiktoken --prefer-binary` + ### 2. Setting Up Your Crew with the YAML Configuration To create a new CrewAI project, run the following CLI (Command Line Interface) command: diff --git a/pyproject.toml b/pyproject.toml index 3f10c1a87..bcc00a0d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,27 +8,38 @@ authors = [ { name = "Joao Moura", email = "joao@crewai.com" } ] dependencies = [ + # Core Dependencies "pydantic>=2.4.2", "openai>=1.13.3", + "litellm>=1.44.22", + "instructor>=1.3.3", + + # Text Processing + "pdfplumber>=0.11.4", + "regex>=2024.9.11", + + # Telemetry and Monitoring "opentelemetry-api>=1.22.0", "opentelemetry-sdk>=1.22.0", "opentelemetry-exporter-otlp-proto-http>=1.22.0", - "instructor>=1.3.3", - "regex>=2024.9.11", - "click>=8.1.7", + + # Data Handling + "chromadb>=0.5.23", + "openpyxl>=3.1.5", + "pyvis>=0.3.2", + + # Authentication and Security + "auth0-python>=4.7.1", "python-dotenv>=1.0.0", + + # Configuration and Utils + "click>=8.1.7", "appdirs>=1.4.4", "jsonref>=1.1.0", "json-repair>=0.25.2", - "auth0-python>=4.7.1", - "litellm>=1.44.22", - "pyvis>=0.3.2", "uv>=0.4.25", "tomli-w>=1.1.0", "tomli>=2.0.2", - "chromadb>=0.5.23", - "pdfplumber>=0.11.4", - "openpyxl>=3.1.5", "blinker>=1.9.0", ] @@ -39,6 +50,9 @@ Repository = "https://github.com/crewAIInc/crewAI" [project.optional-dependencies] tools = ["crewai-tools>=0.17.0"] +embeddings = [ + "tiktoken~=0.7.0" +] agentops = ["agentops>=0.3.0"] fastembed = ["fastembed>=0.4.1"] pdfplumber = [ From 45b802a6252334402947451d26f4fdc6b5c72629 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 01:39:19 -0300 Subject: [PATCH 16/23] Docstring, Error Handling, and Type Hints Improvements (#1828) * docs: add comprehensive docstrings to Flow class and methods - Added NumPy-style docstrings to all decorator functions - Added detailed documentation to Flow class methods - Included parameter types, return types, and examples - Enhanced documentation clarity and completeness Co-Authored-By: Joe Moura * feat: add secure path handling utilities - Add path_utils.py with safe path handling functions - Implement path validation and security checks - Integrate secure path handling in flow_visualizer.py - Add path validation in html_template_handler.py - Add comprehensive error handling for path operations Co-Authored-By: Joe Moura * docs: add comprehensive docstrings and type hints to flow utils (#1819) Co-Authored-By: Joe Moura * fix: add type annotations and fix import sorting Co-Authored-By: Joe Moura * fix: add type annotations to flow utils and visualization utils Co-Authored-By: Joe Moura * fix: resolve import sorting and type annotation issues Co-Authored-By: Joe Moura * fix: properly initialize and update edge_smooth variable Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura --- src/crewai/flow/flow.py | 282 ++++++++++++++++++++++- src/crewai/flow/flow_visualizer.py | 232 ++++++++++++++----- src/crewai/flow/html_template_handler.py | 25 +- src/crewai/flow/path_utils.py | 135 +++++++++++ src/crewai/flow/utils.py | 172 ++++++++++++-- src/crewai/flow/visualization_utils.py | 130 ++++++++++- 6 files changed, 889 insertions(+), 87 deletions(-) create mode 100644 src/crewai/flow/path_utils.py diff --git a/src/crewai/flow/flow.py b/src/crewai/flow/flow.py index 4a6361cce..806d9ec84 100644 --- a/src/crewai/flow/flow.py +++ b/src/crewai/flow/flow.py @@ -30,7 +30,47 @@ from crewai.telemetry import Telemetry T = TypeVar("T", bound=Union[BaseModel, Dict[str, Any]]) -def start(condition=None): +def start(condition: Optional[Union[str, dict, Callable]] = None) -> Callable: + """ + Marks a method as a flow's starting point. + + This decorator designates a method as an entry point for the flow execution. + It can optionally specify conditions that trigger the start based on other + method executions. + + Parameters + ---------- + condition : Optional[Union[str, dict, Callable]], optional + Defines when the start method should execute. Can be: + - str: Name of a method that triggers this start + - dict: Contains "type" ("AND"/"OR") and "methods" (list of triggers) + - Callable: A method reference that triggers this start + Default is None, meaning unconditional start. + + Returns + ------- + Callable + A decorator function that marks the method as a flow start point. + + Raises + ------ + ValueError + If the condition format is invalid. + + Examples + -------- + >>> @start() # Unconditional start + >>> def begin_flow(self): + ... pass + + >>> @start("method_name") # Start after specific method + >>> def conditional_start(self): + ... pass + + >>> @start(and_("method1", "method2")) # Start after multiple methods + >>> def complex_start(self): + ... pass + """ def decorator(func): func.__is_start_method__ = True if condition is not None: @@ -56,7 +96,42 @@ def start(condition=None): return decorator -def listen(condition): +def listen(condition: Union[str, dict, Callable]) -> Callable: + """ + Creates a listener that executes when specified conditions are met. + + This decorator sets up a method to execute in response to other method + executions in the flow. It supports both simple and complex triggering + conditions. + + Parameters + ---------- + condition : Union[str, dict, Callable] + Specifies when the listener should execute. Can be: + - str: Name of a method that triggers this listener + - dict: Contains "type" ("AND"/"OR") and "methods" (list of triggers) + - Callable: A method reference that triggers this listener + + Returns + ------- + Callable + A decorator function that sets up the method as a listener. + + Raises + ------ + ValueError + If the condition format is invalid. + + Examples + -------- + >>> @listen("process_data") # Listen to single method + >>> def handle_processed_data(self): + ... pass + + >>> @listen(or_("success", "failure")) # Listen to multiple methods + >>> def handle_completion(self): + ... pass + """ def decorator(func): if isinstance(condition, str): func.__trigger_methods__ = [condition] @@ -80,7 +155,47 @@ def listen(condition): return decorator -def router(condition): +def router(condition: Union[str, dict, Callable]) -> Callable: + """ + Creates a routing method that directs flow execution based on conditions. + + This decorator marks a method as a router, which can dynamically determine + the next steps in the flow based on its return value. Routers are triggered + by specified conditions and can return constants that determine which path + the flow should take. + + Parameters + ---------- + condition : Union[str, dict, Callable] + Specifies when the router should execute. Can be: + - str: Name of a method that triggers this router + - dict: Contains "type" ("AND"/"OR") and "methods" (list of triggers) + - Callable: A method reference that triggers this router + + Returns + ------- + Callable + A decorator function that sets up the method as a router. + + Raises + ------ + ValueError + If the condition format is invalid. + + Examples + -------- + >>> @router("check_status") + >>> def route_based_on_status(self): + ... if self.state.status == "success": + ... return SUCCESS + ... return FAILURE + + >>> @router(and_("validate", "process")) + >>> def complex_routing(self): + ... if all([self.state.valid, self.state.processed]): + ... return CONTINUE + ... return STOP + """ def decorator(func): func.__is_router__ = True # Handle conditions like listen/start @@ -106,7 +221,39 @@ def router(condition): return decorator -def or_(*conditions): +def or_(*conditions: Union[str, dict, Callable]) -> dict: + """ + Combines multiple conditions with OR logic for flow control. + + Creates a condition that is satisfied when any of the specified conditions + are met. This is used with @start, @listen, or @router decorators to create + complex triggering conditions. + + Parameters + ---------- + *conditions : Union[str, dict, Callable] + Variable number of conditions that can be: + - str: Method names + - dict: Existing condition dictionaries + - Callable: Method references + + Returns + ------- + dict + A condition dictionary with format: + {"type": "OR", "methods": list_of_method_names} + + Raises + ------ + ValueError + If any condition is invalid. + + Examples + -------- + >>> @listen(or_("success", "timeout")) + >>> def handle_completion(self): + ... pass + """ methods = [] for condition in conditions: if isinstance(condition, dict) and "methods" in condition: @@ -120,7 +267,39 @@ def or_(*conditions): return {"type": "OR", "methods": methods} -def and_(*conditions): +def and_(*conditions: Union[str, dict, Callable]) -> dict: + """ + Combines multiple conditions with AND logic for flow control. + + Creates a condition that is satisfied only when all specified conditions + are met. This is used with @start, @listen, or @router decorators to create + complex triggering conditions. + + Parameters + ---------- + *conditions : Union[str, dict, Callable] + Variable number of conditions that can be: + - str: Method names + - dict: Existing condition dictionaries + - Callable: Method references + + Returns + ------- + dict + A condition dictionary with format: + {"type": "AND", "methods": list_of_method_names} + + Raises + ------ + ValueError + If any condition is invalid. + + Examples + -------- + >>> @listen(and_("validated", "processed")) + >>> def handle_complete_data(self): + ... pass + """ methods = [] for condition in conditions: if isinstance(condition, dict) and "methods" in condition: @@ -286,6 +465,23 @@ class Flow(Generic[T], metaclass=FlowMeta): return final_output async def _execute_start_method(self, start_method_name: str) -> None: + """ + Executes a flow's start method and its triggered listeners. + + This internal method handles the execution of methods marked with @start + decorator and manages the subsequent chain of listener executions. + + Parameters + ---------- + start_method_name : str + The name of the start method to execute. + + Notes + ----- + - Executes the start method and captures its result + - Triggers execution of any listeners waiting on this start method + - Part of the flow's initialization sequence + """ result = await self._execute_method( start_method_name, self._methods[start_method_name] ) @@ -306,6 +502,28 @@ class Flow(Generic[T], metaclass=FlowMeta): return result async def _execute_listeners(self, trigger_method: str, result: Any) -> None: + """ + Executes all listeners and routers triggered by a method completion. + + This internal method manages the execution flow by: + 1. First executing all triggered routers sequentially + 2. Then executing all triggered listeners in parallel + + Parameters + ---------- + trigger_method : str + The name of the method that triggered these listeners. + result : Any + The result from the triggering method, passed to listeners + that accept parameters. + + Notes + ----- + - Routers are executed sequentially to maintain flow control + - Each router's result becomes the new trigger_method + - Normal listeners are executed in parallel for efficiency + - Listeners can receive the trigger method's result as a parameter + """ # First, handle routers repeatedly until no router triggers anymore while True: routers_triggered = self._find_triggered_methods( @@ -335,6 +553,33 @@ class Flow(Generic[T], metaclass=FlowMeta): def _find_triggered_methods( self, trigger_method: str, router_only: bool ) -> List[str]: + """ + Finds all methods that should be triggered based on conditions. + + This internal method evaluates both OR and AND conditions to determine + which methods should be executed next in the flow. + + Parameters + ---------- + trigger_method : str + The name of the method that just completed execution. + router_only : bool + If True, only consider router methods. + If False, only consider non-router methods. + + Returns + ------- + List[str] + Names of methods that should be triggered. + + Notes + ----- + - Handles both OR and AND conditions: + * OR: Triggers if any condition is met + * AND: Triggers only when all conditions are met + - Maintains state for AND conditions using _pending_and_listeners + - Separates router and normal listener evaluation + """ triggered = [] for listener_name, (condition_type, methods) in self._listeners.items(): is_router = listener_name in self._routers @@ -363,6 +608,33 @@ class Flow(Generic[T], metaclass=FlowMeta): return triggered async def _execute_single_listener(self, listener_name: str, result: Any) -> None: + """ + Executes a single listener method with proper event handling. + + This internal method manages the execution of an individual listener, + including parameter inspection, event emission, and error handling. + + Parameters + ---------- + listener_name : str + The name of the listener method to execute. + result : Any + The result from the triggering method, which may be passed + to the listener if it accepts parameters. + + Notes + ----- + - Inspects method signature to determine if it accepts the trigger result + - Emits events for method execution start and finish + - Handles errors gracefully with detailed logging + - Recursively triggers listeners of this listener + - Supports both parameterized and parameter-less listeners + + Error Handling + ------------- + Catches and logs any exceptions during execution, preventing + individual listener failures from breaking the entire flow. + """ try: method = self._methods[listener_name] diff --git a/src/crewai/flow/flow_visualizer.py b/src/crewai/flow/flow_visualizer.py index 988f27919..ceacee91f 100644 --- a/src/crewai/flow/flow_visualizer.py +++ b/src/crewai/flow/flow_visualizer.py @@ -1,12 +1,14 @@ # flow_visualizer.py import os +from pathlib import Path from pyvis.network import Network from crewai.flow.config import COLORS, NODE_STYLES from crewai.flow.html_template_handler import HTMLTemplateHandler from crewai.flow.legend_generator import generate_legend_items_html, get_legend_items +from crewai.flow.path_utils import safe_path_join, validate_path_exists from crewai.flow.utils import calculate_node_levels from crewai.flow.visualization_utils import ( add_edges, @@ -17,88 +19,206 @@ from crewai.flow.visualization_utils import ( class FlowPlot: def __init__(self, flow): + """ + Initialize FlowPlot with a flow object. + + Parameters + ---------- + flow : Flow + A Flow instance to visualize. + + Raises + ------ + ValueError + If flow object is invalid or missing required attributes. + """ + if not hasattr(flow, '_methods'): + raise ValueError("Invalid flow object: missing '_methods' attribute") + if not hasattr(flow, '_listeners'): + raise ValueError("Invalid flow object: missing '_listeners' attribute") + if not hasattr(flow, '_start_methods'): + raise ValueError("Invalid flow object: missing '_start_methods' attribute") + self.flow = flow self.colors = COLORS self.node_styles = NODE_STYLES def plot(self, filename): - net = Network( - directed=True, - height="750px", - width="100%", - bgcolor=self.colors["bg"], - layout=None, - ) - - # Set options to disable physics - net.set_options( - """ - var options = { - "nodes": { - "font": { - "multi": "html" - } - }, - "physics": { - "enabled": false - } - } """ - ) + Generate and save an HTML visualization of the flow. - # Calculate levels for nodes - node_levels = calculate_node_levels(self.flow) + Parameters + ---------- + filename : str + Name of the output file (without extension). - # Compute positions - node_positions = compute_positions(self.flow, node_levels) + Raises + ------ + ValueError + If filename is invalid or network generation fails. + IOError + If file operations fail or visualization cannot be generated. + RuntimeError + If network visualization generation fails. + """ + if not filename or not isinstance(filename, str): + raise ValueError("Filename must be a non-empty string") + + try: + # Initialize network + net = Network( + directed=True, + height="750px", + width="100%", + bgcolor=self.colors["bg"], + layout=None, + ) - # Add nodes to the network - add_nodes_to_network(net, self.flow, node_positions, self.node_styles) + # Set options to disable physics + net.set_options( + """ + var options = { + "nodes": { + "font": { + "multi": "html" + } + }, + "physics": { + "enabled": false + } + } + """ + ) - # Add edges to the network - add_edges(net, self.flow, node_positions, self.colors) + # Calculate levels for nodes + try: + node_levels = calculate_node_levels(self.flow) + except Exception as e: + raise ValueError(f"Failed to calculate node levels: {str(e)}") - network_html = net.generate_html() - final_html_content = self._generate_final_html(network_html) + # Compute positions + try: + node_positions = compute_positions(self.flow, node_levels) + except Exception as e: + raise ValueError(f"Failed to compute node positions: {str(e)}") - # Save the final HTML content to the file - with open(f"{filename}.html", "w", encoding="utf-8") as f: - f.write(final_html_content) - print(f"Plot saved as {filename}.html") + # Add nodes to the network + try: + add_nodes_to_network(net, self.flow, node_positions, self.node_styles) + except Exception as e: + raise RuntimeError(f"Failed to add nodes to network: {str(e)}") - self._cleanup_pyvis_lib() + # Add edges to the network + try: + add_edges(net, self.flow, node_positions, self.colors) + except Exception as e: + raise RuntimeError(f"Failed to add edges to network: {str(e)}") + + # Generate HTML + try: + network_html = net.generate_html() + final_html_content = self._generate_final_html(network_html) + except Exception as e: + raise RuntimeError(f"Failed to generate network visualization: {str(e)}") + + # Save the final HTML content to the file + try: + with open(f"{filename}.html", "w", encoding="utf-8") as f: + f.write(final_html_content) + print(f"Plot saved as {filename}.html") + except IOError as e: + raise IOError(f"Failed to save flow visualization to {filename}.html: {str(e)}") + + except (ValueError, RuntimeError, IOError) as e: + raise e + except Exception as e: + raise RuntimeError(f"Unexpected error during flow visualization: {str(e)}") + finally: + self._cleanup_pyvis_lib() def _generate_final_html(self, network_html): - # Extract just the body content from the generated HTML - current_dir = os.path.dirname(__file__) - template_path = os.path.join( - current_dir, "assets", "crewai_flow_visual_template.html" - ) - logo_path = os.path.join(current_dir, "assets", "crewai_logo.svg") + """ + Generate the final HTML content with network visualization and legend. - html_handler = HTMLTemplateHandler(template_path, logo_path) - network_body = html_handler.extract_body_content(network_html) + Parameters + ---------- + network_html : str + HTML content generated by pyvis Network. - # Generate the legend items HTML - legend_items = get_legend_items(self.colors) - legend_items_html = generate_legend_items_html(legend_items) - final_html_content = html_handler.generate_final_html( - network_body, legend_items_html - ) - return final_html_content + Returns + ------- + str + Complete HTML content with styling and legend. + + Raises + ------ + IOError + If template or logo files cannot be accessed. + ValueError + If network_html is invalid. + """ + if not network_html: + raise ValueError("Invalid network HTML content") + + try: + # Extract just the body content from the generated HTML + current_dir = os.path.dirname(__file__) + template_path = safe_path_join("assets", "crewai_flow_visual_template.html", root=current_dir) + logo_path = safe_path_join("assets", "crewai_logo.svg", root=current_dir) + + if not os.path.exists(template_path): + raise IOError(f"Template file not found: {template_path}") + if not os.path.exists(logo_path): + raise IOError(f"Logo file not found: {logo_path}") + + html_handler = HTMLTemplateHandler(template_path, logo_path) + network_body = html_handler.extract_body_content(network_html) + + # Generate the legend items HTML + legend_items = get_legend_items(self.colors) + legend_items_html = generate_legend_items_html(legend_items) + final_html_content = html_handler.generate_final_html( + network_body, legend_items_html + ) + return final_html_content + except Exception as e: + raise IOError(f"Failed to generate visualization HTML: {str(e)}") def _cleanup_pyvis_lib(self): - # Clean up the generated lib folder - lib_folder = os.path.join(os.getcwd(), "lib") + """ + Clean up the generated lib folder from pyvis. + + This method safely removes the temporary lib directory created by pyvis + during network visualization generation. + """ try: + lib_folder = safe_path_join("lib", root=os.getcwd()) if os.path.exists(lib_folder) and os.path.isdir(lib_folder): import shutil - shutil.rmtree(lib_folder) + except ValueError as e: + print(f"Error validating lib folder path: {e}") except Exception as e: - print(f"Error cleaning up {lib_folder}: {e}") + print(f"Error cleaning up lib folder: {e}") def plot_flow(flow, filename="flow_plot"): + """ + Convenience function to create and save a flow visualization. + + Parameters + ---------- + flow : Flow + Flow instance to visualize. + filename : str, optional + Output filename without extension, by default "flow_plot". + + Raises + ------ + ValueError + If flow object or filename is invalid. + IOError + If file operations fail. + """ visualizer = FlowPlot(flow) visualizer.plot(filename) diff --git a/src/crewai/flow/html_template_handler.py b/src/crewai/flow/html_template_handler.py index d521d8cf8..396af5546 100644 --- a/src/crewai/flow/html_template_handler.py +++ b/src/crewai/flow/html_template_handler.py @@ -1,11 +1,32 @@ import base64 import re +from pathlib import Path + +from crewai.flow.path_utils import safe_path_join, validate_path_exists class HTMLTemplateHandler: def __init__(self, template_path, logo_path): - self.template_path = template_path - self.logo_path = logo_path + """ + Initialize HTMLTemplateHandler with validated template and logo paths. + + Parameters + ---------- + template_path : str + Path to the HTML template file. + logo_path : str + Path to the logo image file. + + Raises + ------ + ValueError + If template or logo paths are invalid or files don't exist. + """ + try: + self.template_path = validate_path_exists(template_path, "file") + self.logo_path = validate_path_exists(logo_path, "file") + except ValueError as e: + raise ValueError(f"Invalid template or logo path: {e}") def read_template(self): with open(self.template_path, "r", encoding="utf-8") as f: diff --git a/src/crewai/flow/path_utils.py b/src/crewai/flow/path_utils.py new file mode 100644 index 000000000..09ae8cd3d --- /dev/null +++ b/src/crewai/flow/path_utils.py @@ -0,0 +1,135 @@ +""" +Path utilities for secure file operations in CrewAI flow module. + +This module provides utilities for secure path handling to prevent directory +traversal attacks and ensure paths remain within allowed boundaries. +""" + +import os +from pathlib import Path +from typing import List, Union + + +def safe_path_join(*parts: str, root: Union[str, Path, None] = None) -> str: + """ + Safely join path components and ensure the result is within allowed boundaries. + + Parameters + ---------- + *parts : str + Variable number of path components to join. + root : Union[str, Path, None], optional + Root directory to use as base. If None, uses current working directory. + + Returns + ------- + str + String representation of the resolved path. + + Raises + ------ + ValueError + If the resulting path would be outside the root directory + or if any path component is invalid. + """ + if not parts: + raise ValueError("No path components provided") + + try: + # Convert all parts to strings and clean them + clean_parts = [str(part).strip() for part in parts if part] + if not clean_parts: + raise ValueError("No valid path components provided") + + # Establish root directory + root_path = Path(root).resolve() if root else Path.cwd() + + # Join and resolve the full path + full_path = Path(root_path, *clean_parts).resolve() + + # Check if the resolved path is within root + if not str(full_path).startswith(str(root_path)): + raise ValueError( + f"Invalid path: Potential directory traversal. Path must be within {root_path}" + ) + + return str(full_path) + + except Exception as e: + if isinstance(e, ValueError): + raise + raise ValueError(f"Invalid path components: {str(e)}") + + +def validate_path_exists(path: Union[str, Path], file_type: str = "file") -> str: + """ + Validate that a path exists and is of the expected type. + + Parameters + ---------- + path : Union[str, Path] + Path to validate. + file_type : str, optional + Expected type ('file' or 'directory'), by default 'file'. + + Returns + ------- + str + Validated path as string. + + Raises + ------ + ValueError + If path doesn't exist or is not of expected type. + """ + try: + path_obj = Path(path).resolve() + + if not path_obj.exists(): + raise ValueError(f"Path does not exist: {path}") + + if file_type == "file" and not path_obj.is_file(): + raise ValueError(f"Path is not a file: {path}") + elif file_type == "directory" and not path_obj.is_dir(): + raise ValueError(f"Path is not a directory: {path}") + + return str(path_obj) + + except Exception as e: + if isinstance(e, ValueError): + raise + raise ValueError(f"Invalid path: {str(e)}") + + +def list_files(directory: Union[str, Path], pattern: str = "*") -> List[str]: + """ + Safely list files in a directory matching a pattern. + + Parameters + ---------- + directory : Union[str, Path] + Directory to search in. + pattern : str, optional + Glob pattern to match files against, by default "*". + + Returns + ------- + List[str] + List of matching file paths. + + Raises + ------ + ValueError + If directory is invalid or inaccessible. + """ + try: + dir_path = Path(directory).resolve() + if not dir_path.is_dir(): + raise ValueError(f"Not a directory: {directory}") + + return [str(p) for p in dir_path.glob(pattern) if p.is_file()] + + except Exception as e: + if isinstance(e, ValueError): + raise + raise ValueError(f"Error listing files: {str(e)}") diff --git a/src/crewai/flow/utils.py b/src/crewai/flow/utils.py index dc1f611fb..c0686222f 100644 --- a/src/crewai/flow/utils.py +++ b/src/crewai/flow/utils.py @@ -1,9 +1,25 @@ +""" +Utility functions for flow visualization and dependency analysis. + +This module provides core functionality for analyzing and manipulating flow structures, +including node level calculation, ancestor tracking, and return value analysis. +Functions in this module are primarily used by the visualization system to create +accurate and informative flow diagrams. + +Example +------- +>>> flow = Flow() +>>> node_levels = calculate_node_levels(flow) +>>> ancestors = build_ancestor_dict(flow) +""" + import ast import inspect import textwrap +from typing import Any, Dict, List, Optional, Set, Union -def get_possible_return_constants(function): +def get_possible_return_constants(function: Any) -> Optional[List[str]]: try: source = inspect.getsource(function) except OSError: @@ -77,11 +93,34 @@ def get_possible_return_constants(function): return list(return_values) if return_values else None -def calculate_node_levels(flow): - levels = {} - queue = [] - visited = set() - pending_and_listeners = {} +def calculate_node_levels(flow: Any) -> Dict[str, int]: + """ + Calculate the hierarchical level of each node in the flow. + + Performs a breadth-first traversal of the flow graph to assign levels + to nodes, starting with start methods at level 0. + + Parameters + ---------- + flow : Any + The flow instance containing methods, listeners, and router configurations. + + Returns + ------- + Dict[str, int] + Dictionary mapping method names to their hierarchical levels. + + Notes + ----- + - Start methods are assigned level 0 + - Each subsequent connected node is assigned level = parent_level + 1 + - Handles both OR and AND conditions for listeners + - Processes router paths separately + """ + levels: Dict[str, int] = {} + queue: List[str] = [] + visited: Set[str] = set() + pending_and_listeners: Dict[str, Set[str]] = {} # Make all start methods at level 0 for method_name, method in flow._methods.items(): @@ -140,7 +179,20 @@ def calculate_node_levels(flow): return levels -def count_outgoing_edges(flow): +def count_outgoing_edges(flow: Any) -> Dict[str, int]: + """ + Count the number of outgoing edges for each method in the flow. + + Parameters + ---------- + flow : Any + The flow instance to analyze. + + Returns + ------- + Dict[str, int] + Dictionary mapping method names to their outgoing edge count. + """ counts = {} for method_name in flow._methods: counts[method_name] = 0 @@ -152,16 +204,53 @@ def count_outgoing_edges(flow): return counts -def build_ancestor_dict(flow): - ancestors = {node: set() for node in flow._methods} - visited = set() +def build_ancestor_dict(flow: Any) -> Dict[str, Set[str]]: + """ + Build a dictionary mapping each node to its ancestor nodes. + + Parameters + ---------- + flow : Any + The flow instance to analyze. + + Returns + ------- + Dict[str, Set[str]] + Dictionary mapping each node to a set of its ancestor nodes. + """ + ancestors: Dict[str, Set[str]] = {node: set() for node in flow._methods} + visited: Set[str] = set() for node in flow._methods: if node not in visited: dfs_ancestors(node, ancestors, visited, flow) return ancestors -def dfs_ancestors(node, ancestors, visited, flow): +def dfs_ancestors( + node: str, + ancestors: Dict[str, Set[str]], + visited: Set[str], + flow: Any +) -> None: + """ + Perform depth-first search to build ancestor relationships. + + Parameters + ---------- + node : str + Current node being processed. + ancestors : Dict[str, Set[str]] + Dictionary tracking ancestor relationships. + visited : Set[str] + Set of already visited nodes. + flow : Any + The flow instance being analyzed. + + Notes + ----- + This function modifies the ancestors dictionary in-place to build + the complete ancestor graph. + """ if node in visited: return visited.add(node) @@ -185,12 +274,48 @@ def dfs_ancestors(node, ancestors, visited, flow): dfs_ancestors(listener_name, ancestors, visited, flow) -def is_ancestor(node, ancestor_candidate, ancestors): +def is_ancestor(node: str, ancestor_candidate: str, ancestors: Dict[str, Set[str]]) -> bool: + """ + Check if one node is an ancestor of another. + + Parameters + ---------- + node : str + The node to check ancestors for. + ancestor_candidate : str + The potential ancestor node. + ancestors : Dict[str, Set[str]] + Dictionary containing ancestor relationships. + + Returns + ------- + bool + True if ancestor_candidate is an ancestor of node, False otherwise. + """ return ancestor_candidate in ancestors.get(node, set()) -def build_parent_children_dict(flow): - parent_children = {} +def build_parent_children_dict(flow: Any) -> Dict[str, List[str]]: + """ + Build a dictionary mapping parent nodes to their children. + + Parameters + ---------- + flow : Any + The flow instance to analyze. + + Returns + ------- + Dict[str, List[str]] + Dictionary mapping parent method names to lists of their child method names. + + Notes + ----- + - Maps listeners to their trigger methods + - Maps router methods to their paths and listeners + - Children lists are sorted for consistent ordering + """ + parent_children: Dict[str, List[str]] = {} # Map listeners to their trigger methods for listener_name, (_, trigger_methods) in flow._listeners.items(): @@ -214,7 +339,24 @@ def build_parent_children_dict(flow): return parent_children -def get_child_index(parent, child, parent_children): +def get_child_index(parent: str, child: str, parent_children: Dict[str, List[str]]) -> int: + """ + Get the index of a child node in its parent's sorted children list. + + Parameters + ---------- + parent : str + The parent node name. + child : str + The child node name to find the index for. + parent_children : Dict[str, List[str]] + Dictionary mapping parents to their children lists. + + Returns + ------- + int + Zero-based index of the child in its parent's sorted children list. + """ children = parent_children.get(parent, []) children.sort() return children.index(child) diff --git a/src/crewai/flow/visualization_utils.py b/src/crewai/flow/visualization_utils.py index 321f63344..70f527f1a 100644 --- a/src/crewai/flow/visualization_utils.py +++ b/src/crewai/flow/visualization_utils.py @@ -1,5 +1,23 @@ +""" +Utilities for creating visual representations of flow structures. + +This module provides functions for generating network visualizations of flows, +including node placement, edge creation, and visual styling. It handles the +conversion of flow structures into visual network graphs with appropriate +styling and layout. + +Example +------- +>>> flow = Flow() +>>> net = Network(directed=True) +>>> node_positions = compute_positions(flow, node_levels) +>>> add_nodes_to_network(net, flow, node_positions, node_styles) +>>> add_edges(net, flow, node_positions, colors) +""" + import ast import inspect +from typing import Any, Dict, List, Optional, Tuple, Union from .utils import ( build_ancestor_dict, @@ -9,8 +27,25 @@ from .utils import ( ) -def method_calls_crew(method): - """Check if the method calls `.crew()`.""" +def method_calls_crew(method: Any) -> bool: + """ + Check if the method contains a call to `.crew()`. + + Parameters + ---------- + method : Any + The method to analyze for crew() calls. + + Returns + ------- + bool + True if the method calls .crew(), False otherwise. + + Notes + ----- + Uses AST analysis to detect method calls, specifically looking for + attribute access of 'crew'. + """ try: source = inspect.getsource(method) source = inspect.cleandoc(source) @@ -34,7 +69,34 @@ def method_calls_crew(method): return visitor.found -def add_nodes_to_network(net, flow, node_positions, node_styles): +def add_nodes_to_network( + net: Any, + flow: Any, + node_positions: Dict[str, Tuple[float, float]], + node_styles: Dict[str, Dict[str, Any]] +) -> None: + """ + Add nodes to the network visualization with appropriate styling. + + Parameters + ---------- + net : Any + The pyvis Network instance to add nodes to. + flow : Any + The flow instance containing method information. + node_positions : Dict[str, Tuple[float, float]] + Dictionary mapping node names to their (x, y) positions. + node_styles : Dict[str, Dict[str, Any]] + Dictionary containing style configurations for different node types. + + Notes + ----- + Node types include: + - Start methods + - Router methods + - Crew methods + - Regular methods + """ def human_friendly_label(method_name): return method_name.replace("_", " ").title() @@ -73,9 +135,33 @@ def add_nodes_to_network(net, flow, node_positions, node_styles): ) -def compute_positions(flow, node_levels, y_spacing=150, x_spacing=150): - level_nodes = {} - node_positions = {} +def compute_positions( + flow: Any, + node_levels: Dict[str, int], + y_spacing: float = 150, + x_spacing: float = 150 +) -> Dict[str, Tuple[float, float]]: + """ + Compute the (x, y) positions for each node in the flow graph. + + Parameters + ---------- + flow : Any + The flow instance to compute positions for. + node_levels : Dict[str, int] + Dictionary mapping node names to their hierarchical levels. + y_spacing : float, optional + Vertical spacing between levels, by default 150. + x_spacing : float, optional + Horizontal spacing between nodes, by default 150. + + Returns + ------- + Dict[str, Tuple[float, float]] + Dictionary mapping node names to their (x, y) coordinates. + """ + level_nodes: Dict[int, List[str]] = {} + node_positions: Dict[str, Tuple[float, float]] = {} for method_name, level in node_levels.items(): level_nodes.setdefault(level, []).append(method_name) @@ -90,7 +176,33 @@ def compute_positions(flow, node_levels, y_spacing=150, x_spacing=150): return node_positions -def add_edges(net, flow, node_positions, colors): +def add_edges( + net: Any, + flow: Any, + node_positions: Dict[str, Tuple[float, float]], + colors: Dict[str, str] +) -> None: + edge_smooth: Dict[str, Union[str, float]] = {"type": "continuous"} # Default value + """ + Add edges to the network visualization with appropriate styling. + + Parameters + ---------- + net : Any + The pyvis Network instance to add edges to. + flow : Any + The flow instance containing edge information. + node_positions : Dict[str, Tuple[float, float]] + Dictionary mapping node names to their positions. + colors : Dict[str, str] + Dictionary mapping edge types to their colors. + + Notes + ----- + - Handles both normal listener edges and router edges + - Applies appropriate styling (color, dashes) based on edge type + - Adds curvature to edges when needed (cycles or multiple children) + """ ancestors = build_ancestor_dict(flow) parent_children = build_parent_children_dict(flow) @@ -126,7 +238,7 @@ def add_edges(net, flow, node_positions, colors): else: edge_smooth = {"type": "cubicBezier"} else: - edge_smooth = False + edge_smooth.update({"type": "continuous"}) edge_style = { "color": edge_color, @@ -189,7 +301,7 @@ def add_edges(net, flow, node_positions, colors): else: edge_smooth = {"type": "cubicBezier"} else: - edge_smooth = False + edge_smooth.update({"type": "continuous"}) edge_style = { "color": colors["router_edge"], From a548463faebd22aa3167a13ad417b4ab89776478 Mon Sep 17 00:00:00 2001 From: Marco Vinciguerra <88108002+VinciGit00@users.noreply.github.com> Date: Tue, 31 Dec 2024 05:51:43 +0100 Subject: [PATCH 17/23] feat: add docstring (#1819) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Moura --- src/crewai/flow/flow.py | 3 --- src/crewai/flow/flow_visualizer.py | 2 ++ src/crewai/flow/html_template_handler.py | 7 +++++++ src/crewai/flow/legend_generator.py | 1 + src/crewai/flow/visualization_utils.py | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/crewai/flow/flow.py b/src/crewai/flow/flow.py index 806d9ec84..dc46aa6d8 100644 --- a/src/crewai/flow/flow.py +++ b/src/crewai/flow/flow.py @@ -95,7 +95,6 @@ def start(condition: Optional[Union[str, dict, Callable]] = None) -> Callable: return decorator - def listen(condition: Union[str, dict, Callable]) -> Callable: """ Creates a listener that executes when specified conditions are met. @@ -198,7 +197,6 @@ def router(condition: Union[str, dict, Callable]) -> Callable: """ def decorator(func): func.__is_router__ = True - # Handle conditions like listen/start if isinstance(condition, str): func.__trigger_methods__ = [condition] func.__condition_type__ = "OR" @@ -220,7 +218,6 @@ def router(condition: Union[str, dict, Callable]) -> Callable: return decorator - def or_(*conditions: Union[str, dict, Callable]) -> dict: """ Combines multiple conditions with OR logic for flow control. diff --git a/src/crewai/flow/flow_visualizer.py b/src/crewai/flow/flow_visualizer.py index ceacee91f..a70e91a18 100644 --- a/src/crewai/flow/flow_visualizer.py +++ b/src/crewai/flow/flow_visualizer.py @@ -18,6 +18,8 @@ from crewai.flow.visualization_utils import ( class FlowPlot: + """Handles the creation and rendering of flow visualization diagrams.""" + def __init__(self, flow): """ Initialize FlowPlot with a flow object. diff --git a/src/crewai/flow/html_template_handler.py b/src/crewai/flow/html_template_handler.py index 396af5546..f0d2d89ad 100644 --- a/src/crewai/flow/html_template_handler.py +++ b/src/crewai/flow/html_template_handler.py @@ -6,6 +6,8 @@ from crewai.flow.path_utils import safe_path_join, validate_path_exists class HTMLTemplateHandler: + """Handles HTML template processing and generation for flow visualization diagrams.""" + def __init__(self, template_path, logo_path): """ Initialize HTMLTemplateHandler with validated template and logo paths. @@ -29,19 +31,23 @@ class HTMLTemplateHandler: raise ValueError(f"Invalid template or logo path: {e}") def read_template(self): + """Read and return the HTML template file contents.""" with open(self.template_path, "r", encoding="utf-8") as f: return f.read() def encode_logo(self): + """Convert the logo SVG file to base64 encoded string.""" with open(self.logo_path, "rb") as logo_file: logo_svg_data = logo_file.read() return base64.b64encode(logo_svg_data).decode("utf-8") def extract_body_content(self, html): + """Extract and return content between body tags from HTML string.""" match = re.search("(.*?)", html, re.DOTALL) return match.group(1) if match else "" def generate_legend_items_html(self, legend_items): + """Generate HTML markup for the legend items.""" legend_items_html = "" for item in legend_items: if "border" in item: @@ -69,6 +75,7 @@ class HTMLTemplateHandler: return legend_items_html def generate_final_html(self, network_body, legend_items_html, title="Flow Plot"): + """Combine all components into final HTML document with network visualization.""" html_template = self.read_template() logo_svg_base64 = self.encode_logo() diff --git a/src/crewai/flow/legend_generator.py b/src/crewai/flow/legend_generator.py index fb3d5cfd6..f250dec20 100644 --- a/src/crewai/flow/legend_generator.py +++ b/src/crewai/flow/legend_generator.py @@ -1,3 +1,4 @@ + def get_legend_items(colors): return [ {"label": "Start Method", "color": colors["start"]}, diff --git a/src/crewai/flow/visualization_utils.py b/src/crewai/flow/visualization_utils.py index 70f527f1a..781677276 100644 --- a/src/crewai/flow/visualization_utils.py +++ b/src/crewai/flow/visualization_utils.py @@ -55,6 +55,7 @@ def method_calls_crew(method: Any) -> bool: return False class CrewCallVisitor(ast.NodeVisitor): + """AST visitor to detect .crew() method calls.""" def __init__(self): self.found = False From 4469461b38f58e785826766ffd7a3f991d5b5b24 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 01:56:38 -0300 Subject: [PATCH 18/23] fix: Include agent knowledge in planning process (#1818) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: Add test demonstrating knowledge not included in planning process Issue #1703: Add test to verify that agent knowledge sources are not currently included in the planning process. This test will help validate the fix once implemented. - Creates agent with knowledge sources - Verifies knowledge context missing from planning - Checks other expected components are present Co-Authored-By: Joe Moura * fix: Include agent knowledge in planning process Issue #1703: Integrate agent knowledge sources into planning summaries - Add agent_knowledge field to task summaries in planning_handler - Update test to verify knowledge inclusion - Ensure knowledge context is available during planning phase The planning agent now has access to agent knowledge when creating task execution plans, allowing for better informed planning decisions. Co-Authored-By: Joe Moura * style: Fix import sorting in test_knowledge_planning.py - Reorganize imports according to ruff linting rules - Fix I001 linting error Co-Authored-By: Joe Moura * test: Update task summary assertions to include knowledge field Co-Authored-By: Joe Moura * fix: Update ChromaDB mock path and fix knowledge string formatting Co-Authored-By: Joe Moura * fix: Improve knowledge integration in planning process with error handling Co-Authored-By: Joe Moura * fix: Update task summary format for empty tools and knowledge - Change empty tools message to 'agent has no tools' - Remove agent_knowledge field when empty - Update test assertions to match new format - Improve test messages for clarity Co-Authored-By: Joe Moura * fix: Update string formatting for agent tools in task summary Co-Authored-By: Joe Moura * fix: Update string formatting for agent tools in task summary Co-Authored-By: Joe Moura * fix: Update string formatting for agent tools and knowledge in task summary Co-Authored-By: Joe Moura * fix: Update knowledge field formatting in task summary Co-Authored-By: Joe Moura * style: Fix import sorting in test_planning_handler.py Co-Authored-By: Joe Moura * style: Fix import sorting order in test_planning_handler.py Co-Authored-By: Joe Moura * test: Add ChromaDB mocking to test_create_tasks_summary_with_knowledge_and_tools Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura Co-authored-by: João Moura --- src/crewai/utilities/planning_handler.py | 34 +++++++-- tests/utilities/test_knowledge_planning.py | 84 ++++++++++++++++++++++ tests/utilities/test_planning_handler.py | 73 ++++++++++++++++++- 3 files changed, 184 insertions(+), 7 deletions(-) create mode 100644 tests/utilities/test_knowledge_planning.py diff --git a/src/crewai/utilities/planning_handler.py b/src/crewai/utilities/planning_handler.py index 590f42389..21ee093a1 100644 --- a/src/crewai/utilities/planning_handler.py +++ b/src/crewai/utilities/planning_handler.py @@ -1,3 +1,5 @@ +import json +import logging from typing import Any, List, Optional from pydantic import BaseModel, Field @@ -5,6 +7,8 @@ from pydantic import BaseModel, Field from crewai.agent import Agent from crewai.task import Task +logger = logging.getLogger(__name__) + class PlanPerTask(BaseModel): task: str = Field(..., description="The task for which the plan is created") @@ -68,19 +72,39 @@ class CrewPlanner: output_pydantic=PlannerTaskPydanticOutput, ) + def _get_agent_knowledge(self, task: Task) -> List[str]: + """ + Safely retrieve knowledge source content from the task's agent. + + Args: + task: The task containing an agent with potential knowledge sources + + Returns: + List[str]: A list of knowledge source strings + """ + try: + if task.agent and task.agent.knowledge_sources: + return [source.content for source in task.agent.knowledge_sources] + except AttributeError: + logger.warning("Error accessing agent knowledge sources") + return [] + def _create_tasks_summary(self) -> str: """Creates a summary of all tasks.""" tasks_summary = [] for idx, task in enumerate(self.tasks): - tasks_summary.append( - f""" + knowledge_list = self._get_agent_knowledge(task) + task_summary = f""" Task Number {idx + 1} - {task.description} "task_description": {task.description} "task_expected_output": {task.expected_output} "agent": {task.agent.role if task.agent else "None"} "agent_goal": {task.agent.goal if task.agent else "None"} "task_tools": {task.tools} - "agent_tools": {task.agent.tools if task.agent else "None"} - """ - ) + "agent_tools": %s%s""" % ( + f"[{', '.join(str(tool) for tool in task.agent.tools)}]" if task.agent and task.agent.tools else '"agent has no tools"', + f',\n "agent_knowledge": "[\\"{knowledge_list[0]}\\"]"' if knowledge_list and str(knowledge_list) != "None" else "" + ) + + tasks_summary.append(task_summary) return " ".join(tasks_summary) diff --git a/tests/utilities/test_knowledge_planning.py b/tests/utilities/test_knowledge_planning.py new file mode 100644 index 000000000..37b6df69f --- /dev/null +++ b/tests/utilities/test_knowledge_planning.py @@ -0,0 +1,84 @@ +""" +Tests for verifying the integration of knowledge sources in the planning process. +This module ensures that agent knowledge is properly included during task planning. +""" + +from unittest.mock import patch + +import pytest + +from crewai.agent import Agent +from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource +from crewai.task import Task +from crewai.utilities.planning_handler import CrewPlanner + + +@pytest.fixture +def mock_knowledge_source(): + """ + Create a mock knowledge source with test content. + Returns: + StringKnowledgeSource: + A knowledge source containing AI-related test content + """ + content = """ + Important context about AI: + 1. AI systems use machine learning algorithms + 2. Neural networks are a key component + 3. Training data is essential for good performance + """ + return StringKnowledgeSource(content=content) + +@patch('crewai.knowledge.storage.knowledge_storage.chromadb') +def test_knowledge_included_in_planning(mock_chroma): + """Test that verifies knowledge sources are properly included in planning.""" + # Mock ChromaDB collection + mock_collection = mock_chroma.return_value.get_or_create_collection.return_value + mock_collection.add.return_value = None + + # Create an agent with knowledge + agent = Agent( + role="AI Researcher", + goal="Research and explain AI concepts", + backstory="Expert in artificial intelligence", + knowledge_sources=[ + StringKnowledgeSource( + content="AI systems require careful training and validation." + ) + ] + ) + + # Create a task for the agent + task = Task( + description="Explain the basics of AI systems", + expected_output="A clear explanation of AI fundamentals", + agent=agent + ) + + # Create a crew planner + planner = CrewPlanner([task], None) + + # Get the task summary + task_summary = planner._create_tasks_summary() + + # Verify that knowledge is included in planning when present + assert "AI systems require careful training" in task_summary, \ + "Knowledge content should be present in task summary when knowledge exists" + assert '"agent_knowledge"' in task_summary, \ + "agent_knowledge field should be present in task summary when knowledge exists" + + # Verify that knowledge is properly formatted + assert isinstance(task.agent.knowledge_sources, list), \ + "Knowledge sources should be stored in a list" + assert len(task.agent.knowledge_sources) > 0, \ + "At least one knowledge source should be present" + assert task.agent.knowledge_sources[0].content in task_summary, \ + "Knowledge source content should be included in task summary" + + # Verify that other expected components are still present + assert task.description in task_summary, \ + "Task description should be present in task summary" + assert task.expected_output in task_summary, \ + "Expected output should be present in task summary" + assert agent.role in task_summary, \ + "Agent role should be present in task summary" diff --git a/tests/utilities/test_planning_handler.py b/tests/utilities/test_planning_handler.py index 85101606d..e15877c9f 100644 --- a/tests/utilities/test_planning_handler.py +++ b/tests/utilities/test_planning_handler.py @@ -1,10 +1,14 @@ -from unittest.mock import patch +from typing import Optional +from unittest.mock import MagicMock, patch import pytest +from pydantic import BaseModel from crewai.agent import Agent +from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource from crewai.task import Task from crewai.tasks.task_output import TaskOutput +from crewai.tools.base_tool import BaseTool from crewai.utilities.planning_handler import ( CrewPlanner, PlannerTaskPydanticOutput, @@ -92,7 +96,72 @@ class TestCrewPlanner: tasks_summary = crew_planner._create_tasks_summary() assert isinstance(tasks_summary, str) assert tasks_summary.startswith("\n Task Number 1 - Task 1") - assert tasks_summary.endswith('"agent_tools": []\n ') + assert '"agent_tools": "agent has no tools"' in tasks_summary + # Knowledge field should not be present when empty + assert '"agent_knowledge"' not in tasks_summary + + @patch('crewai.knowledge.storage.knowledge_storage.chromadb') + def test_create_tasks_summary_with_knowledge_and_tools(self, mock_chroma): + """Test task summary generation with both knowledge and tools present.""" + # Mock ChromaDB collection + mock_collection = mock_chroma.return_value.get_or_create_collection.return_value + mock_collection.add.return_value = None + + # Create mock tools with proper string descriptions and structured tool support + class MockTool(BaseTool): + name: str + description: str + + def __init__(self, name: str, description: str): + tool_data = {"name": name, "description": description} + super().__init__(**tool_data) + + def __str__(self): + return self.name + + def __repr__(self): + return self.name + + def to_structured_tool(self): + return self + + def _run(self, *args, **kwargs): + pass + + def _generate_description(self) -> str: + """Override _generate_description to avoid args_schema handling.""" + return self.description + + tool1 = MockTool("tool1", "Tool 1 description") + tool2 = MockTool("tool2", "Tool 2 description") + + # Create a task with knowledge and tools + task = Task( + description="Task with knowledge and tools", + expected_output="Expected output", + agent=Agent( + role="Test Agent", + goal="Test Goal", + backstory="Test Backstory", + tools=[tool1, tool2], + knowledge_sources=[ + StringKnowledgeSource(content="Test knowledge content") + ] + ) + ) + + # Create planner with the new task + planner = CrewPlanner([task], None) + tasks_summary = planner._create_tasks_summary() + + # Verify task summary content + assert isinstance(tasks_summary, str) + assert task.description in tasks_summary + assert task.expected_output in tasks_summary + assert '"agent_tools": [tool1, tool2]' in tasks_summary + assert '"agent_knowledge": "[\\"Test knowledge content\\"]"' in tasks_summary + assert task.agent.role in tasks_summary + assert task.agent.goal in tasks_summary def test_handle_crew_planning_different_llm(self, crew_planner_different_llm): with patch.object(Task, "execute_sync") as execute: From ba89e43b62981a3f722b09563105fa078ea8326a Mon Sep 17 00:00:00 2001 From: "Brandon Hancock (bhancock_ai)" <109994880+bhancockio@users.noreply.github.com> Date: Tue, 31 Dec 2024 16:40:51 -0500 Subject: [PATCH 19/23] Suppressed userWarnings from litellm pydantic issues (#1833) * Suppressed userWarnings from litellm pydantic issues * change litellm version * Fix failling ollama tasks --- pyproject.toml | 2 +- src/crewai/crew.py | 30 +- src/crewai/llm.py | 8 +- src/crewai/utilities/internal_instructor.py | 8 +- .../utilities/token_counter_callback.py | 20 +- tests/agent_test.py | 23 +- .../test_agent_execute_task_with_ollama.yaml | 908 ++++++++++++++++-- .../test_agent_with_ollama_gemma.yaml | 397 -------- .../test_agent_with_ollama_llama3.yaml | 863 +++++++++++++++++ .../test_llm_call_with_ollama_gemma.yaml | 35 - .../test_llm_call_with_ollama_llama3.yaml | 449 +++++++++ uv.lock | 38 +- 12 files changed, 2238 insertions(+), 543 deletions(-) delete mode 100644 tests/cassettes/test_agent_with_ollama_gemma.yaml create mode 100644 tests/cassettes/test_agent_with_ollama_llama3.yaml delete mode 100644 tests/cassettes/test_llm_call_with_ollama_gemma.yaml create mode 100644 tests/cassettes/test_llm_call_with_ollama_llama3.yaml diff --git a/pyproject.toml b/pyproject.toml index bcc00a0d9..10d7ea62d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ # Core Dependencies "pydantic>=2.4.2", "openai>=1.13.3", - "litellm>=1.44.22", + "litellm>=1.56.4", "instructor>=1.3.3", # Text Processing diff --git a/src/crewai/crew.py b/src/crewai/crew.py index d488783ea..c01a89280 100644 --- a/src/crewai/crew.py +++ b/src/crewai/crew.py @@ -726,11 +726,7 @@ class Crew(BaseModel): # Determine which tools to use - task tools take precedence over agent tools tools_for_task = task.tools or agent_to_use.tools or [] - tools_for_task = self._prepare_tools( - agent_to_use, - task, - tools_for_task - ) + tools_for_task = self._prepare_tools(agent_to_use, task, tools_for_task) self._log_task_start(task, agent_to_use.role) @@ -797,14 +793,18 @@ class Crew(BaseModel): return skipped_task_output return None - def _prepare_tools(self, agent: BaseAgent, task: Task, tools: List[Tool]) -> List[Tool]: + def _prepare_tools( + self, agent: BaseAgent, task: Task, tools: List[Tool] + ) -> List[Tool]: # Add delegation tools if agent allows delegation if agent.allow_delegation: if self.process == Process.hierarchical: if self.manager_agent: tools = self._update_manager_tools(task, tools) else: - raise ValueError("Manager agent is required for hierarchical process.") + raise ValueError( + "Manager agent is required for hierarchical process." + ) elif agent and agent.allow_delegation: tools = self._add_delegation_tools(task, tools) @@ -823,7 +823,9 @@ class Crew(BaseModel): return self.manager_agent return task.agent - def _merge_tools(self, existing_tools: List[Tool], new_tools: List[Tool]) -> List[Tool]: + def _merge_tools( + self, existing_tools: List[Tool], new_tools: List[Tool] + ) -> List[Tool]: """Merge new tools into existing tools list, avoiding duplicates by tool name.""" if not new_tools: return existing_tools @@ -839,7 +841,9 @@ class Crew(BaseModel): return tools - def _inject_delegation_tools(self, tools: List[Tool], task_agent: BaseAgent, agents: List[BaseAgent]): + def _inject_delegation_tools( + self, tools: List[Tool], task_agent: BaseAgent, agents: List[BaseAgent] + ): delegation_tools = task_agent.get_delegation_tools(agents) return self._merge_tools(tools, delegation_tools) @@ -856,7 +860,9 @@ class Crew(BaseModel): if len(self.agents) > 1 and len(agents_for_delegation) > 0 and task.agent: if not tools: tools = [] - tools = self._inject_delegation_tools(tools, task.agent, agents_for_delegation) + tools = self._inject_delegation_tools( + tools, task.agent, agents_for_delegation + ) return tools def _log_task_start(self, task: Task, role: str = "None"): @@ -870,7 +876,9 @@ class Crew(BaseModel): if task.agent: tools = self._inject_delegation_tools(tools, task.agent, [task.agent]) else: - tools = self._inject_delegation_tools(tools, self.manager_agent, self.agents) + tools = self._inject_delegation_tools( + tools, self.manager_agent, self.agents + ) return tools def _get_context(self, task: Task, task_outputs: List[TaskOutput]): diff --git a/src/crewai/llm.py b/src/crewai/llm.py index 5d6a0ccf5..bdac7080a 100644 --- a/src/crewai/llm.py +++ b/src/crewai/llm.py @@ -6,8 +6,10 @@ import warnings from contextlib import contextmanager from typing import Any, Dict, List, Optional, Union -import litellm -from litellm import get_supported_openai_params +with warnings.catch_warnings(): + warnings.simplefilter("ignore", UserWarning) + import litellm + from litellm import get_supported_openai_params from crewai.utilities.exceptions.context_window_exceeding_exception import ( LLMContextLengthExceededException, @@ -138,7 +140,7 @@ class LLM: self.kwargs = kwargs litellm.drop_params = True - litellm.set_verbose = False + self.set_callbacks(callbacks) self.set_env_callbacks() diff --git a/src/crewai/utilities/internal_instructor.py b/src/crewai/utilities/internal_instructor.py index 13fe5a19f..a3206ba15 100644 --- a/src/crewai/utilities/internal_instructor.py +++ b/src/crewai/utilities/internal_instructor.py @@ -1,3 +1,4 @@ +import warnings from typing import Any, Optional, Type @@ -25,9 +26,10 @@ class InternalInstructor: if self.agent and not self.llm: self.llm = self.agent.function_calling_llm or self.agent.llm - # Lazy import - import instructor - from litellm import completion + with warnings.catch_warnings(): + warnings.simplefilter("ignore", UserWarning) + import instructor + from litellm import completion self._client = instructor.from_litellm( completion, diff --git a/src/crewai/utilities/token_counter_callback.py b/src/crewai/utilities/token_counter_callback.py index 06ad15022..46c7c68f9 100644 --- a/src/crewai/utilities/token_counter_callback.py +++ b/src/crewai/utilities/token_counter_callback.py @@ -1,3 +1,5 @@ +import warnings + from litellm.integrations.custom_logger import CustomLogger from litellm.types.utils import Usage @@ -12,11 +14,13 @@ class TokenCalcHandler(CustomLogger): if self.token_cost_process is None: return - usage: Usage = response_obj["usage"] - self.token_cost_process.sum_successful_requests(1) - self.token_cost_process.sum_prompt_tokens(usage.prompt_tokens) - self.token_cost_process.sum_completion_tokens(usage.completion_tokens) - if usage.prompt_tokens_details: - self.token_cost_process.sum_cached_prompt_tokens( - usage.prompt_tokens_details.cached_tokens - ) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", UserWarning) + usage: Usage = response_obj["usage"] + self.token_cost_process.sum_successful_requests(1) + self.token_cost_process.sum_prompt_tokens(usage.prompt_tokens) + self.token_cost_process.sum_completion_tokens(usage.completion_tokens) + if usage.prompt_tokens_details: + self.token_cost_process.sum_cached_prompt_tokens( + usage.prompt_tokens_details.cached_tokens + ) diff --git a/tests/agent_test.py b/tests/agent_test.py index 6879a4519..679f4832e 100644 --- a/tests/agent_test.py +++ b/tests/agent_test.py @@ -1445,34 +1445,31 @@ def test_llm_call_with_all_attributes(): @pytest.mark.vcr(filter_headers=["authorization"]) -def test_agent_with_ollama_gemma(): +def test_agent_with_ollama_llama3(): agent = Agent( role="test role", goal="test goal", backstory="test backstory", - llm=LLM( - model="ollama/gemma2:latest", - base_url="http://localhost:8080", - ), + llm=LLM(model="ollama/llama3.2:3b", base_url="http://localhost:11434"), ) assert isinstance(agent.llm, LLM) - assert agent.llm.model == "ollama/gemma2:latest" - assert agent.llm.base_url == "http://localhost:8080" + assert agent.llm.model == "ollama/llama3.2:3b" + assert agent.llm.base_url == "http://localhost:11434" task = "Respond in 20 words. Who are you?" response = agent.llm.call([{"role": "user", "content": task}]) assert response assert len(response.split()) <= 25 # Allow a little flexibility in word count - assert "Gemma" in response or "AI" in response or "language model" in response + assert "Llama3" in response or "AI" in response or "language model" in response @pytest.mark.vcr(filter_headers=["authorization"]) -def test_llm_call_with_ollama_gemma(): +def test_llm_call_with_ollama_llama3(): llm = LLM( - model="ollama/gemma2:latest", - base_url="http://localhost:8080", + model="ollama/llama3.2:3b", + base_url="http://localhost:11434", temperature=0.7, max_tokens=30, ) @@ -1482,7 +1479,7 @@ def test_llm_call_with_ollama_gemma(): assert response assert len(response.split()) <= 25 # Allow a little flexibility in word count - assert "Gemma" in response or "AI" in response or "language model" in response + assert "Llama3" in response or "AI" in response or "language model" in response @pytest.mark.vcr(filter_headers=["authorization"]) @@ -1578,7 +1575,7 @@ def test_agent_execute_task_with_ollama(): role="test role", goal="test goal", backstory="test backstory", - llm=LLM(model="ollama/gemma2:latest", base_url="http://localhost:8080"), + llm=LLM(model="ollama/llama3.2:3b", base_url="http://localhost:11434"), ) task = Task( diff --git a/tests/cassettes/test_agent_execute_task_with_ollama.yaml b/tests/cassettes/test_agent_execute_task_with_ollama.yaml index 62f1fe37f..8228b53a7 100644 --- a/tests/cassettes/test_agent_execute_task_with_ollama.yaml +++ b/tests/cassettes/test_agent_execute_task_with_ollama.yaml @@ -1,42 +1,6 @@ interactions: - request: - body: !!binary | - CrcCCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSjgIKEgoQY3Jld2FpLnRl - bGVtZXRyeRJoChA/Q8UW5bidCRtKvri5fOaNEgh5qLzvLvZJkioQVG9vbCBVc2FnZSBFcnJvcjAB - OYjFVQr1TPgXQXCXhwr1TPgXShoKDmNyZXdhaV92ZXJzaW9uEggKBjAuNjEuMHoCGAGFAQABAAAS - jQEKEChQTWQ07t26ELkZmP5RresSCHEivRGBpsP7KgpUb29sIFVzYWdlMAE5sKkbC/VM+BdB8MIc - C/VM+BdKGgoOY3Jld2FpX3ZlcnNpb24SCAoGMC42MS4wShkKCXRvb2xfbmFtZRIMCgpkdW1teV90 - b29sSg4KCGF0dGVtcHRzEgIYAXoCGAGFAQABAAA= - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '314' - Content-Type: - - application/x-protobuf - User-Agent: - - OTel-OTLP-Exporter-Python/1.27.0 - method: POST - uri: https://telemetry.crewai.com:4319/v1/traces - response: - body: - string: "\n\0" - headers: - Content-Length: - - '2' - Content-Type: - - application/x-protobuf - Date: - - Tue, 24 Sep 2024 21:57:54 GMT - status: - code: 200 - message: OK -- request: - body: '{"model": "gemma2:latest", "prompt": "### System:\nYou are test role. test + body: '{"model": "llama3.2:3b", "prompt": "### System:\nYou are test role. test backstory\nYour personal goal is: test goal\nTo give my best complete final answer to the task use the exact following format:\n\nThought: I now can give a great answer\nFinal Answer: Your final answer must be the great and the most @@ -46,36 +10,864 @@ interactions: explanation of AI\nyou MUST return the actual complete content as the final answer, not a summary.\n\nBegin! This is VERY important to you, use the tools available and give your best Final Answer, your job depends on it!\n\nThought:\n\n", - "options": {}, "stream": false}' + "options": {"stop": ["\nObservation:"]}, "stream": false}' headers: - Accept: + accept: - '*/*' - Accept-Encoding: + accept-encoding: - gzip, deflate - Connection: + connection: - keep-alive - Content-Length: - - '815' - Content-Type: - - application/json - User-Agent: - - python-requests/2.31.0 + content-length: + - '839' + host: + - localhost:11434 + user-agent: + - litellm/1.56.4 method: POST - uri: http://localhost:8080/api/generate + uri: http://localhost:11434/api/generate response: - body: - string: '{"model":"gemma2:latest","created_at":"2024-09-24T21:57:55.835715Z","response":"Thought: - I can explain AI in one sentence. \n\nFinal Answer: Artificial intelligence - (AI) is the ability of computer systems to perform tasks that typically require - human intelligence, such as learning, problem-solving, and decision-making. \n","done":true,"done_reason":"stop","context":[106,1645,108,6176,1479,235292,108,2045,708,2121,4731,235265,2121,135147,108,6922,3749,6789,603,235292,2121,6789,108,1469,2734,970,1963,3407,2048,3448,577,573,6911,1281,573,5463,2412,5920,235292,109,65366,235292,590,1490,798,2734,476,1775,3448,108,11263,10358,235292,3883,2048,3448,2004,614,573,1775,578,573,1546,3407,685,3077,235269,665,2004,614,17526,6547,235265,109,235285,44472,1281,1450,32808,235269,970,3356,12014,611,665,235341,109,6176,4926,235292,109,6846,12297,235292,36576,1212,16481,603,575,974,13060,109,1596,603,573,5246,12830,604,861,2048,3448,235292,586,974,235290,47366,15844,576,16481,108,4747,44472,2203,573,5579,3407,3381,685,573,2048,3448,235269,780,476,13367,235265,109,12694,235341,1417,603,50471,2845,577,692,235269,1281,573,8112,2506,578,2734,861,1963,14124,10358,235269,861,3356,12014,611,665,235341,109,65366,235292,109,107,108,106,2516,108,65366,235292,590,798,10200,16481,575,974,13060,235265,235248,109,11263,10358,235292,42456,17273,591,11716,235275,603,573,7374,576,6875,5188,577,3114,13333,674,15976,2817,3515,17273,235269,1582,685,6044,235269,3210,235290,60495,235269,578,4530,235290,14577,235265,139,108],"total_duration":3370959792,"load_duration":20611750,"prompt_eval_count":173,"prompt_eval_duration":688036000,"eval_count":51,"eval_duration":2660291000}' + content: '{"model":"llama3.2:3b","created_at":"2024-12-31T16:56:15.759718Z","response":"Final + Answer: Artificial Intelligence (AI) refers to the development of computer systems + able to perform tasks that typically require human intelligence, including learning, + problem-solving, decision-making, and perception.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,744,512,2675,527,1296,3560,13,1296,93371,198,7927,4443,5915,374,25,1296,5915,198,1271,3041,856,1888,4686,1620,4320,311,279,3465,1005,279,4839,2768,3645,1473,85269,25,358,1457,649,3041,264,2294,4320,198,19918,22559,25,4718,1620,4320,2011,387,279,2294,323,279,1455,4686,439,3284,11,433,2011,387,15632,7633,382,40,28832,1005,1521,20447,11,856,2683,14117,389,433,2268,14711,2724,1473,5520,5546,25,83017,1148,15592,374,304,832,11914,271,2028,374,279,1755,13186,369,701,1620,4320,25,362,832,1355,18886,16540,315,15592,198,9514,28832,471,279,5150,4686,2262,439,279,1620,4320,11,539,264,12399,382,11382,0,1115,374,48174,3062,311,499,11,1005,279,7526,2561,323,3041,701,1888,13321,22559,11,701,2683,14117,389,433,2268,85269,1473,128009,128006,78191,128007,271,19918,22559,25,59294,22107,320,15836,8,19813,311,279,4500,315,6500,6067,3025,311,2804,9256,430,11383,1397,3823,11478,11,2737,6975,11,3575,99246,11,5597,28846,11,323,21063,13],"total_duration":1156303250,"load_duration":35999125,"prompt_eval_count":181,"prompt_eval_duration":408000000,"eval_count":38,"eval_duration":711000000}' headers: Content-Length: - - '1662' + - '1528' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 24 Sep 2024 21:57:55 GMT - status: - code: 200 - message: OK + - Tue, 31 Dec 2024 16:56:15 GMT + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"name": "llama3.2:3b"}' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '23' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - litellm/1.56.4 + method: POST + uri: http://localhost:11434/api/show + response: + content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version + Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms + and conditions for use, reproduction, distribution \\nand modification of the + Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, + manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed + to promoting safe and fair use of its tools and features, including Llama 3.2. + If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). + The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama + show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# + FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE + \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER + stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE + \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: + September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions + for use, reproduction, distribution \\nand modification of the Llama Materials + set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals + and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta + is committed to promoting safe and fair use of its tools and features, including + Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use + Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be + found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop + \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" + headers: + Content-Type: + - application/json; charset=utf-8 + Date: + - Tue, 31 Dec 2024 16:56:15 GMT + Transfer-Encoding: + - chunked + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"name": "llama3.2:3b"}' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '23' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - litellm/1.56.4 + method: POST + uri: http://localhost:11434/api/show + response: + content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version + Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms + and conditions for use, reproduction, distribution \\nand modification of the + Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, + manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed + to promoting safe and fair use of its tools and features, including Llama 3.2. + If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). + The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama + show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# + FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE + \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER + stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE + \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: + September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions + for use, reproduction, distribution \\nand modification of the Llama Materials + set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals + and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta + is committed to promoting safe and fair use of its tools and features, including + Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use + Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be + found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop + \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" + headers: + Content-Type: + - application/json; charset=utf-8 + Date: + - Tue, 31 Dec 2024 16:56:15 GMT + Transfer-Encoding: + - chunked + http_version: HTTP/1.1 + status_code: 200 version: 1 diff --git a/tests/cassettes/test_agent_with_ollama_gemma.yaml b/tests/cassettes/test_agent_with_ollama_gemma.yaml deleted file mode 100644 index 86e829fbc..000000000 --- a/tests/cassettes/test_agent_with_ollama_gemma.yaml +++ /dev/null @@ -1,397 +0,0 @@ -interactions: -- request: - body: !!binary | - CumTAQokCiIKDHNlcnZpY2UubmFtZRISChBjcmV3QUktdGVsZW1ldHJ5Er+TAQoSChBjcmV3YWku - dGVsZW1ldHJ5EqoHChDvqD2QZooz9BkEwtbWjp4OEgjxh72KACHvZSoMQ3JldyBDcmVhdGVkMAE5 - qMhNnvBM+BdBcO9PnvBM+BdKGgoOY3Jld2FpX3ZlcnNpb24SCAoGMC42MS4wShoKDnB5dGhvbl92 - ZXJzaW9uEggKBjMuMTEuN0ouCghjcmV3X2tleRIiCiBkNTUxMTNiZTRhY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QyZDYtZjA4Ni00YjIyLWE4YzEtMzI4MDk3NTU2NmFkegIYAYUBAAEA - AA== - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '18925' - Content-Type: - - application/x-protobuf - User-Agent: - - OTel-OTLP-Exporter-Python/1.27.0 - method: POST - uri: https://telemetry.crewai.com:4319/v1/traces - response: - body: - string: "\n\0" - headers: - Content-Length: - - '2' - Content-Type: - - application/x-protobuf - Date: - - Tue, 24 Sep 2024 21:57:39 GMT - status: - code: 200 - message: OK -- request: - body: '{"model": "gemma2:latest", "prompt": "### User:\nRespond in 20 words. Who - are you?\n\n", "options": {}, "stream": false}' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '120' - Content-Type: - - application/json - User-Agent: - - python-requests/2.31.0 - method: POST - uri: http://localhost:8080/api/generate - response: - body: - string: '{"model":"gemma2:latest","created_at":"2024-09-24T21:57:51.284303Z","response":"I - am Gemma, an open-weights AI assistant developed by Google DeepMind. \n","done":true,"done_reason":"stop","context":[106,1645,108,6176,4926,235292,108,54657,575,235248,235284,235276,3907,235265,7702,708,692,235336,109,107,108,106,2516,108,235285,1144,137061,235269,671,2174,235290,30316,16481,20409,6990,731,6238,20555,35777,235265,139,108],"total_duration":14046647083,"load_duration":12942541833,"prompt_eval_count":25,"prompt_eval_duration":177695000,"eval_count":19,"eval_duration":923120000}' - headers: - Content-Length: - - '579' - Content-Type: - - application/json; charset=utf-8 - Date: - - Tue, 24 Sep 2024 21:57:51 GMT - status: - code: 200 - message: OK -version: 1 diff --git a/tests/cassettes/test_agent_with_ollama_llama3.yaml b/tests/cassettes/test_agent_with_ollama_llama3.yaml new file mode 100644 index 000000000..a85abddf2 --- /dev/null +++ b/tests/cassettes/test_agent_with_ollama_llama3.yaml @@ -0,0 +1,863 @@ +interactions: +- request: + body: '{"model": "llama3.2:3b", "prompt": "### User:\nRespond in 20 words. Who + are you?\n\n", "options": {"stop": ["\nObservation:"]}, "stream": false}' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '144' + host: + - localhost:11434 + user-agent: + - litellm/1.56.4 + method: POST + uri: http://localhost:11434/api/generate + response: + content: '{"model":"llama3.2:3b","created_at":"2024-12-31T16:57:54.063894Z","response":"I''m + an AI designed to provide information and assist with inquiries, while maintaining + a neutral and respectful tone always.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,2724,512,66454,304,220,508,4339,13,10699,527,499,1980,128009,128006,78191,128007,271,40,2846,459,15592,6319,311,3493,2038,323,7945,449,44983,11,1418,20958,264,21277,323,49150,16630,2744,13],"total_duration":651386042,"load_duration":41061917,"prompt_eval_count":38,"prompt_eval_duration":204000000,"eval_count":23,"eval_duration":405000000}' + headers: + Content-Length: + - '692' + Content-Type: + - application/json; charset=utf-8 + Date: + - Tue, 31 Dec 2024 16:57:54 GMT + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"name": "llama3.2:3b"}' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '23' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - litellm/1.56.4 + method: POST + uri: http://localhost:11434/api/show + response: + content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version + Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms + and conditions for use, reproduction, distribution \\nand modification of the + Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, + manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed + to promoting safe and fair use of its tools and features, including Llama 3.2. + If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). + The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama + show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# + FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE + \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER + stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE + \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: + September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions + for use, reproduction, distribution \\nand modification of the Llama Materials + set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals + and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta + is committed to promoting safe and fair use of its tools and features, including + Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use + Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be + found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop + \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" + headers: + Content-Type: + - application/json; charset=utf-8 + Date: + - Tue, 31 Dec 2024 16:57:54 GMT + Transfer-Encoding: + - chunked + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"name": "llama3.2:3b"}' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '23' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - litellm/1.56.4 + method: POST + uri: http://localhost:11434/api/show + response: + content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version + Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms + and conditions for use, reproduction, distribution \\nand modification of the + Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, + manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed + to promoting safe and fair use of its tools and features, including Llama 3.2. + If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). + The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama + show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# + FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE + \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER + stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE + \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: + September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions + for use, reproduction, distribution \\nand modification of the Llama Materials + set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals + and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta + is committed to promoting safe and fair use of its tools and features, including + Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use + Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be + found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop + \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" + headers: + Content-Type: + - application/json; charset=utf-8 + Date: + - Tue, 31 Dec 2024 16:57:54 GMT + Transfer-Encoding: + - chunked + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/cassettes/test_llm_call_with_ollama_gemma.yaml b/tests/cassettes/test_llm_call_with_ollama_gemma.yaml deleted file mode 100644 index 9735ae23e..000000000 --- a/tests/cassettes/test_llm_call_with_ollama_gemma.yaml +++ /dev/null @@ -1,35 +0,0 @@ -interactions: -- request: - body: '{"model": "gemma2:latest", "prompt": "### User:\nRespond in 20 words. Who - are you?\n\n", "options": {"num_predict": 30, "temperature": 0.7}, "stream": - false}' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '157' - Content-Type: - - application/json - User-Agent: - - python-requests/2.31.0 - method: POST - uri: http://localhost:8080/api/generate - response: - body: - string: '{"model":"gemma2:latest","created_at":"2024-09-24T21:57:52.329049Z","response":"I - am Gemma, an open-weights AI assistant trained by Google DeepMind. \n","done":true,"done_reason":"stop","context":[106,1645,108,6176,4926,235292,108,54657,575,235248,235284,235276,3907,235265,7702,708,692,235336,109,107,108,106,2516,108,235285,1144,137061,235269,671,2174,235290,30316,16481,20409,17363,731,6238,20555,35777,235265,139,108],"total_duration":991843667,"load_duration":31664750,"prompt_eval_count":25,"prompt_eval_duration":51409000,"eval_count":19,"eval_duration":908132000}' - headers: - Content-Length: - - '572' - Content-Type: - - application/json; charset=utf-8 - Date: - - Tue, 24 Sep 2024 21:57:52 GMT - status: - code: 200 - message: OK -version: 1 diff --git a/tests/cassettes/test_llm_call_with_ollama_llama3.yaml b/tests/cassettes/test_llm_call_with_ollama_llama3.yaml new file mode 100644 index 000000000..0cc413ca3 --- /dev/null +++ b/tests/cassettes/test_llm_call_with_ollama_llama3.yaml @@ -0,0 +1,449 @@ +interactions: +- request: + body: '{"model": "llama3.2:3b", "prompt": "### User:\nRespond in 20 words. Who + are you?\n\n", "options": {"temperature": 0.7, "num_predict": 30}, "stream": + false}' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '155' + host: + - localhost:11434 + user-agent: + - litellm/1.56.4 + method: POST + uri: http://localhost:11434/api/generate + response: + content: '{"model":"llama3.2:3b","created_at":"2024-12-31T17:00:06.295261Z","response":"I''m + an AI assistant, here to provide information and answer questions to the best + of my abilities and knowledge.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,2724,512,66454,304,220,508,4339,13,10699,527,499,1980,128009,128006,78191,128007,271,40,2846,459,15592,18328,11,1618,311,3493,2038,323,4320,4860,311,279,1888,315,856,18000,323,6677,13],"total_duration":826912750,"load_duration":32648125,"prompt_eval_count":38,"prompt_eval_duration":389000000,"eval_count":23,"eval_duration":404000000}' + headers: + Content-Length: + - '675' + Content-Type: + - application/json; charset=utf-8 + Date: + - Tue, 31 Dec 2024 17:00:06 GMT + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"name": "llama3.2:3b"}' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '23' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - litellm/1.56.4 + method: POST + uri: http://localhost:11434/api/show + response: + content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version + Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms + and conditions for use, reproduction, distribution \\nand modification of the + Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, + manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed + to promoting safe and fair use of its tools and features, including Llama 3.2. + If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). + The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama + show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# + FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE + \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER + stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE + \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: + September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions + for use, reproduction, distribution \\nand modification of the Llama Materials + set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals + and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D + or \u201Cyou\u201D means you, or your employer or any other person or entity + (if you are \\nentering into this Agreement on such person or entity\u2019s + behalf), of the age required under\\napplicable laws, rules or regulations to + provide legal consent and that has legal authority\\nto bind your employer or + such other person or entity if you are entering in this Agreement\\non their + behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models + and software and algorithms, including\\nmachine-learning model code, trained + model weights, inference-enabling code, training-enabling code,\\nfine-tuning + enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama + Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation + (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D + or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in + or, \\nif you are an entity, your principal place of business is in the EEA + or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the + EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using + or distributing any portion or element of the Llama Materials,\\nyou agree to + be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n + \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable + and royalty-free limited license under Meta\u2019s intellectual property or + other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, + distribute, copy, create derivative works \\nof, and make modifications to the + Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If + you distribute or make available the Llama Materials (or any derivative works + thereof), \\nor a product or service (including another AI model) that contains + any of them, you shall (A) provide\\na copy of this Agreement with any such + Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non + a related website, user interface, blogpost, about page, or product documentation. + If you use the\\nLlama Materials or any outputs or results of the Llama Materials + to create, train, fine tune, or\\notherwise improve an AI model, which is distributed + or made available, you shall also include \u201CLlama\u201D\\nat the beginning + of any such AI model name.\\n\\n ii. If you receive Llama Materials, + or any derivative works thereof, from a Licensee as part\\nof an integrated + end user product, then Section 2 of this Agreement will not apply to you. \\n\\n + \ iii. You must retain in all copies of the Llama Materials that you distribute + the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed + as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 + Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n + \ iv. Your use of the Llama Materials must comply with applicable laws + and regulations\\n(including trade compliance laws and regulations) and adhere + to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), + which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. + Additional Commercial Terms. If, on the Llama 3.2 version release date, the + monthly active users\\nof the products or services made available by or for + Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly + active users in the preceding calendar month, you must request \\na license + from Meta, which Meta may grant to you in its sole discretion, and you are not + authorized to\\nexercise any of the rights under this Agreement unless or until + Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. + UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS + THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND + IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS + AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR + ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, + TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, + \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, + EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n + \ a. No trademark licenses are granted under this Agreement, and in connection + with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark + owned by or associated with the other or any of its affiliates, \\nexcept as + required for reasonable and customary use in describing and redistributing the + Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants + you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required + \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s + brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). + All goodwill arising out of your use of the Mark \\nwill inure to the benefit + of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and + derivatives made by or for Meta, with respect to any\\n derivative works + and modifications of the Llama Materials that are made by you, as between you + and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n + \ c. If you institute litigation or other proceedings against Meta or any + entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging + that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n + \ of any of the foregoing, constitutes infringement of intellectual property + or other rights owned or licensable\\n by you, then any licenses granted + to you under this Agreement shall terminate as of the date such litigation or\\n + \ claim is filed or instituted. You will indemnify and hold harmless Meta + from and against any claim by any third\\n party arising out of or related + to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. + The term of this Agreement will commence upon your acceptance of this Agreement + or access\\nto the Llama Materials and will continue in full force and effect + until terminated in accordance with the terms\\nand conditions herein. Meta + may terminate this Agreement if you are in breach of any term or condition of + this\\nAgreement. Upon termination of this Agreement, you shall delete and cease + use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination + of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will + be governed and construed under the laws of the State of \\nCalifornia without + regard to choice of law principles, and the UN Convention on Contracts for the + International\\nSale of Goods does not apply to this Agreement. The courts of + California shall have exclusive jurisdiction of\\nany dispute arising out of + this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta + is committed to promoting safe and fair use of its tools and features, including + Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use + Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be + found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited + Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree + you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate + the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, + contribute to, encourage, plan, incite, or further illegal or unlawful activity + or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation + or harm to children, including the solicitation, creation, acquisition, or dissemination + of child exploitative content or failure to report Child Sexual Abuse Material\\n + \ 3. Human trafficking, exploitation, and sexual violence\\n 4. + The illegal distribution of information or materials to minors, including obscene + materials, or failure to employ legally required age-gating in connection with + such information or materials.\\n 5. Sexual solicitation\\n 6. + Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate + the harassment, abuse, threatening, or bullying of individuals or groups of + individuals\\n 2. Engage in, promote, incite, or facilitate discrimination + or other unlawful or harmful conduct in the provision of employment, employment + benefits, credit, housing, other economic benefits, or other essential goods + and services\\n 3. Engage in the unauthorized or unlicensed practice of any + profession including, but not limited to, financial, legal, medical/health, + or related professional practices\\n 4. Collect, process, disclose, generate, + or infer private or sensitive information about individuals, including information + about individuals\u2019 identity, health, or demographic information, unless + you have obtained the right to do so in accordance with applicable law\\n 5. + Engage in or facilitate any action or generate any content that infringes, misappropriates, + or otherwise violates any third-party rights, including the outputs or results + of any products or services using the Llama Materials\\n 6. Create, generate, + or facilitate the creation of malicious code, malware, computer viruses or do + anything else that could disable, overburden, interfere with or impair the proper + working, integrity, operation or appearance of a website or computer system\\n + \ 7. Engage in any action, or facilitate any action, to intentionally circumvent + or remove usage restrictions or other safety measures, or to enable functionality + disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the + planning or development of activities that present a risk of death or bodily + harm to individuals, including use of Llama 3.2 related to the following:\\n + \ 8. Military, warfare, nuclear industries or applications, espionage, use + for materials or activities that are subject to the International Traffic Arms + Regulations (ITAR) maintained by the United States Department of State or to + the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons + Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including + weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n + \ 11. Operation of critical infrastructure, transportation technologies, or + heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, + and eating disorders\\n 13. Any content intended to incite or promote violence, + abuse, or any infliction of bodily harm to an individual\\n3. Intentionally + deceive or mislead others, including use of Llama 3.2 related to the following:\\n + \ 14. Generating, promoting, or furthering fraud or the creation or promotion + of disinformation\\n 15. Generating, promoting, or furthering defamatory + content, including the creation of defamatory statements, images, or other content\\n + \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating + another individual without consent, authorization, or legal right\\n 18. + Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. + Generating or facilitating false online engagement, including fake reviews and + other means of fake online engagement\\n4. Fail to appropriately disclose to + end users any known dangers of your AI system\\n5. Interact with third party + tools, models, or software designed to generate unlawful content or engage in + unlawful or harmful conduct and/or represent that the outputs of such tools, + models, or software are associated with Meta or Llama 3.2\\n\\nWith respect + to any multimodal models included in Llama 3.2, the rights granted under Section + 1(a) of the Llama 3.2 Community License Agreement are not being granted to you + if you are an individual domiciled in, or a company with a principal place of + business in, the European Union. This restriction does not apply to end users + of a product or service that incorporates any such multimodal models.\\n\\nPlease + report any violation of this Policy, software \u201Cbug,\u201D or other problems + that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* + Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* + Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* + Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* + Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama + 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop + \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting + Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- + if .Tools }}When you receive a tool call response, use the output to format + an answer to the orginal user question.\\n\\nYou are a helpful assistant with + tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, + $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- + if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- + if and $.Tools $last }}\\n\\nGiven the following functions, please respond with + a JSON for a function call with its proper arguments that best answers the given + prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": + dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range + $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- + else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- + if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name + }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ + .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- + else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ + .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ + end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" + headers: + Content-Type: + - application/json; charset=utf-8 + Date: + - Tue, 31 Dec 2024 17:00:06 GMT + Transfer-Encoding: + - chunked + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/uv.lock b/uv.lock index c37a1fa4e..dad7b150e 100644 --- a/uv.lock +++ b/uv.lock @@ -1,10 +1,18 @@ version = 1 requires-python = ">=3.10, <3.13" resolution-markers = [ - "python_full_version < '3.11'", - "python_full_version == '3.11.*'", - "python_full_version >= '3.12' and python_full_version < '3.12.4'", - "python_full_version >= '3.12.4'", + "python_full_version < '3.11' and platform_system == 'Darwin'", + "python_full_version < '3.11' and platform_machine == 'aarch64' and platform_system == 'Linux'", + "(python_full_version < '3.11' and platform_machine != 'aarch64' and platform_system != 'Darwin') or (python_full_version < '3.11' and platform_system != 'Darwin' and platform_system != 'Linux')", + "python_full_version == '3.11.*' and platform_system == 'Darwin'", + "python_full_version == '3.11.*' and platform_machine == 'aarch64' and platform_system == 'Linux'", + "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and platform_system != 'Darwin') or (python_full_version == '3.11.*' and platform_system != 'Darwin' and platform_system != 'Linux')", + "python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_system == 'Darwin'", + "python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_machine == 'aarch64' and platform_system == 'Linux'", + "(python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_machine != 'aarch64' and platform_system != 'Darwin') or (python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_system != 'Darwin' and platform_system != 'Linux')", + "python_full_version >= '3.12.4' and platform_system == 'Darwin'", + "python_full_version >= '3.12.4' and platform_machine == 'aarch64' and platform_system == 'Linux'", + "(python_full_version >= '3.12.4' and platform_machine != 'aarch64' and platform_system != 'Darwin') or (python_full_version >= '3.12.4' and platform_system != 'Darwin' and platform_system != 'Linux')", ] [[package]] @@ -620,6 +628,9 @@ agentops = [ docling = [ { name = "docling" }, ] +embeddings = [ + { name = "tiktoken" }, +] fastembed = [ { name = "fastembed" }, ] @@ -642,7 +653,6 @@ tools = [ [package.dev-dependencies] dev = [ { name = "cairosvg" }, - { name = "crewai-tools" }, { name = "mkdocs" }, { name = "mkdocs-material" }, { name = "mkdocs-material-extensions" }, @@ -673,7 +683,7 @@ requires-dist = [ { name = "instructor", specifier = ">=1.3.3" }, { name = "json-repair", specifier = ">=0.25.2" }, { name = "jsonref", specifier = ">=1.1.0" }, - { name = "litellm", specifier = ">=1.44.22" }, + { name = "litellm", specifier = ">=1.56.4" }, { name = "mem0ai", marker = "extra == 'mem0'", specifier = ">=0.1.29" }, { name = "openai", specifier = ">=1.13.3" }, { name = "openpyxl", specifier = ">=3.1.5" }, @@ -688,6 +698,7 @@ requires-dist = [ { name = "python-dotenv", specifier = ">=1.0.0" }, { name = "pyvis", specifier = ">=0.3.2" }, { name = "regex", specifier = ">=2024.9.11" }, + { name = "tiktoken", marker = "extra == 'embeddings'", specifier = "~=0.7.0" }, { name = "tomli", specifier = ">=2.0.2" }, { name = "tomli-w", specifier = ">=1.1.0" }, { name = "uv", specifier = ">=0.4.25" }, @@ -696,7 +707,6 @@ requires-dist = [ [package.metadata.requires-dev] dev = [ { name = "cairosvg", specifier = ">=2.7.1" }, - { name = "crewai-tools", specifier = ">=0.17.0" }, { name = "mkdocs", specifier = ">=1.4.3" }, { name = "mkdocs-material", specifier = ">=9.5.7" }, { name = "mkdocs-material-extensions", specifier = ">=1.3.1" }, @@ -2219,24 +2229,24 @@ wheels = [ [[package]] name = "litellm" -version = "1.50.2" +version = "1.56.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "aiohttp" }, { name = "click" }, + { name = "httpx" }, { name = "importlib-metadata" }, { name = "jinja2" }, { name = "jsonschema" }, { name = "openai" }, { name = "pydantic" }, { name = "python-dotenv" }, - { name = "requests" }, { name = "tiktoken" }, { name = "tokenizers" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a7/45/4d54617b267a96f1f7c17c0010ea1aba20e30a3672b873fe92a6001e5952/litellm-1.50.2.tar.gz", hash = "sha256:b244c9a0e069cc626b85fb9f5cc252114aaff1225500da30ce0940f841aef8ea", size = 6096949 } +sdist = { url = "https://files.pythonhosted.org/packages/83/ea/2c51d16c244a64dd3f0bdb1757aef798cf943b92e5695da04e3e42ba09e0/litellm-1.56.4.tar.gz", hash = "sha256:2808ca21878d200f7676a3d11e5bf2b5e3349ae504628f279cd7297c7dbd2038", size = 6284983 } wheels = [ - { url = "https://files.pythonhosted.org/packages/22/f3/89a4d65d1b9286eb5ac6a6e92dd93523d92f3142a832e60c00d5cad64176/litellm-1.50.2-py3-none-any.whl", hash = "sha256:99cac60c78037946ab809b7cfbbadad53507bb2db8ae39391b4be215a0869fdd", size = 6318265 }, + { url = "https://files.pythonhosted.org/packages/8f/25/2fd7b28a270b2963e8fa0ecf6aab4db47c54d932cc5aac8bc87e7ebc3755/litellm-1.56.4-py3-none-any.whl", hash = "sha256:699a8db46f7de045069a77c435e13244b5fdaf5df1c8cb5e6ad675ef7e104ccd", size = 6564370 }, ] [[package]] @@ -3030,7 +3040,7 @@ wheels = [ [[package]] name = "openai" -version = "1.52.1" +version = "1.58.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, @@ -3042,9 +3052,9 @@ dependencies = [ { name = "tqdm" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/80/ac/54c76352d493866637756b7c0ecec44f0b5bafb8fe753d98472cf6cfe4ce/openai-1.52.1.tar.gz", hash = "sha256:383b96c7e937cbec23cad5bf5718085381e4313ca33c5c5896b54f8e1b19d144", size = 310069 } +sdist = { url = "https://files.pythonhosted.org/packages/27/3c/b1ecce430ed56fa3ac1b0676966d3250aab9c70a408232b71e419ea62148/openai-1.58.1.tar.gz", hash = "sha256:f5a035fd01e141fc743f4b0e02c41ca49be8fab0866d3b67f5f29b4f4d3c0973", size = 343411 } wheels = [ - { url = "https://files.pythonhosted.org/packages/ad/31/28a83e124e9f9dd04c83b5aeb6f8b1770f45addde4dd3d34d9a9091590ad/openai-1.52.1-py3-none-any.whl", hash = "sha256:f23e83df5ba04ee0e82c8562571e8cb596cd88f9a84ab783e6c6259e5ffbfb4a", size = 386945 }, + { url = "https://files.pythonhosted.org/packages/8e/5a/d22cd07f1a99b9e8b3c92ee0c1959188db4318828a3d88c9daac120bdd69/openai-1.58.1-py3-none-any.whl", hash = "sha256:e2910b1170a6b7f88ef491ac3a42c387f08bd3db533411f7ee391d166571d63c", size = 454279 }, ] [[package]] From 4bcc3b532d1d86de0fd70c085b6f1181c845b3db Mon Sep 17 00:00:00 2001 From: "Brandon Hancock (bhancock_ai)" <109994880+bhancockio@users.noreply.github.com> Date: Thu, 2 Jan 2025 16:06:48 -0500 Subject: [PATCH 20/23] Trying out timeouts (#1840) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make tests green again * Add Git validations for publishing tools (#1381) This commit prevents tools from being published if the underlying Git repository is unsynced with origin. * fix: JSON encoding date objects (#1374) * Update README (#1376) * Change all instaces of crewAI to CrewAI and fix installation step * Update the example to use YAML format * Update to come after setup and edits * Remove double tool instance * docs: correct miswritten command name (#1365) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Add `--force` option to `crewai tool publish` (#1383) This commit adds an option to bypass Git remote validations when publishing tools. * add plotting to flows documentation (#1394) * Brandon/cre 288 add telemetry to flows (#1391) * Telemetry for flows * store node names * Brandon/cre 291 flow improvements (#1390) * Implement joao feedback * update colors for crew nodes * clean up * more linting clean up * round legend corners --------- Co-authored-by: João Moura * quick fixes (#1385) * quick fixes * add generic name --------- Co-authored-by: João Moura * reduce import time by 6x (#1396) * reduce import by 6x * fix linting * Added version details (#1402) Co-authored-by: João Moura * Update twitter logo to x-twiiter (#1403) * fix task cloning error (#1416) * Migrate docs from MkDocs to Mintlify (#1423) * add new mintlify docs * add favicon.svg * minor edits * add github stats * Fix/logger - fix #1412 (#1413) * improved logger * log file looks better * better lines written to log file --------- Co-authored-by: João Moura * fixing tests * preparing new version * updating init * Preparing new version * Trying to fix linting and other warnings (#1417) * Trying to fix linting * fixing more type issues * clean up ci * more ci fixes --------- Co-authored-by: Eduardo Chiarotti * Feat/poetry to uv migration (#1406) * feat: Start migrating to UV * feat: add uv to flows * feat: update docs on Poetry -> uv * feat: update docs and uv.locl * feat: update tests and github CI * feat: run ruff format * feat: update typechecking * feat: fix type checking * feat: update python version * feat: type checking gic * feat: adapt uv command to run the tool repo * Adapt tool build command to uv * feat: update logic to let only projects with crew to be deployed * feat: add uv to tools * fix; tests * fix: remove breakpoint * fix :test * feat: add crewai update to migrate from poetry to uv * fix: tests * feat: add validation for ˆ character on pyproject * feat: add run_crew to pyproject if doesnt exist * feat: add validation for poetry migration * fix: warning --------- Co-authored-by: Vinicius Brasil * fix: training issue (#1433) * fix: training issue * fix: output from crew * fix: message * Use a slice for the manager request. Make the task use the agent i18n settings (#1446) * Fix Cache Typo in Documentation (#1441) * Correct the role for the message being added to the messages list (#1438) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * fix typo in template file (#1432) * Adapt Tools CLI to uv (#1455) * Adapt Tools CLI to UV * Fix failing test * use the same i18n as the agent for tool usage (#1440) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Upgrade docs to mirror change from `Poetry` to `UV` (#1451) * Update docs to use instead of * Add Flows YouTube tutorial & link images * feat: ADd warning from poetry -> uv (#1458) * feat/updated CLI to allow for model selection & submitting API keys (#1430) * updated CLI to allow for submitting API keys * updated click prompt to remove default number * removed all unnecessary comments * feat: implement crew creation CLI command - refactor code to multiple functions - Added ability for users to select provider and model when uing crewai create command and ave API key to .env * refactered select_choice function for early return * refactored select_provider to have an ealry return * cleanup of comments * refactor/Move functions into utils file, added new provider file and migrated fucntions thre, new constants file + general function refactor * small comment cleanup * fix unnecessary deps --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> Co-authored-by: Brandon Hancock * Fix incorrect parameter name in Vision tool docs page (#1461) Co-authored-by: João Moura * Feat/memory base (#1444) * byom - short/entity memory * better * rm uneeded * fix text * use context * rm dep and sync * type check fix * fixed test using new cassete * fixing types * fixed types * fix types * fixed types * fixing types * fix type * cassette update * just mock the return of short term mem * remove print * try catch block * added docs * dding error handling here * preparing new version * fixing annotations * fix tasks and agents ordering * Avoiding exceptions * feat: add poetry.lock to uv migration (#1468) * fix tool calling issue (#1467) * fix tool calling issue * Update tool type check * Drop print * cutting new version * new verison * Adapt `crewai tool install ` to uv (#1481) This commit updates the tool install comamnd to uv's new custom index feature. Related: https://github.com/astral-sh/uv/pull/7746/ * fix(docs): typo (#1470) * drop unneccesary tests (#1484) * drop uneccesary tests * fix linting * simplify flow (#1482) * simplify flow * propogate changes * Update docs and scripts * Template fix * make flow kickoff sync * Clean up docs * Add Cerebras LLM example configuration to LLM docs (#1488) * ensure original embedding config works (#1476) * ensure original embedding config works * some fixes * raise error on unsupported provider * WIP: brandons notes * fixes * rm prints * fixed docs * fixed run types * updates to add more docs and correct imports with huggingface embedding server enabled --------- Co-authored-by: Brandon Hancock * use copy to split testing and training on crews (#1491) * use copy to split testing and training on crews * make tests handle new copy functionality on train and test * fix last test * fix test * preparing new verison * fix/fixed missing API prompt + CLI docs update (#1464) * updated CLI to allow for submitting API keys * updated click prompt to remove default number * removed all unnecessary comments * feat: implement crew creation CLI command - refactor code to multiple functions - Added ability for users to select provider and model when uing crewai create command and ave API key to .env * refactered select_choice function for early return * refactored select_provider to have an ealry return * cleanup of comments * refactor/Move functions into utils file, added new provider file and migrated fucntions thre, new constants file + general function refactor * small comment cleanup * fix unnecessary deps * Added docs for new CLI provider + fixed missing API prompt * Minor doc updates * allow user to bypass api key entry + incorect number selected logic + ruff formatting * ruff updates * Fix spelling mistake --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> Co-authored-by: Brandon Hancock * chore(readme-fix): fixing step for 'running tests' in the contribution section (#1490) Co-authored-by: Eduardo Chiarotti * support unsafe code execution. add in docker install and running checks. (#1496) * support unsafe code execution. add in docker install and running checks. * Update return type * Fix memory imports for embedding functions (#1497) * updating crewai version * new version * new version * update plot command (#1504) * feat: add tomli so we can support 3.10 (#1506) * feat: add tomli so we can support 3.10 * feat: add validation for poetry data * Forward install command options to `uv sync` (#1510) Allow passing additional options from `crewai install` directly to `uv sync`. This enables commands like `crewai install --locked` to work as expected by forwarding all flags and options to the underlying uv command. * improve tool text description and args (#1512) * improve tool text descriptoin and args * fix lint * Drop print * add back in docstring * Improve tooling docs * Update flow docs to talk about self evaluation example * Update flow docs to talk about self evaluation example * Update flows.mdx - Fix link * Update flows cli to allow you to easily add additional crews to a flow (#1525) * Update flows cli to allow you to easily add additional crews to a flow * fix failing test * adding more error logs to test thats failing * try again * Bugfix/flows with multiple starts plus ands breaking (#1531) * bugfix/flows-with-multiple-starts-plus-ands-breaking * fix user found issue * remove prints * prepare new version * Added security.md file (#1533) * Disable telemetry explicitly (#1536) * Disable telemetry explicitly * fix linting * revert parts to og * Enhance log storage to support more data types (#1530) * Add llm providers accordion group (#1534) * add llm providers accordion group * fix numbering * Replace .netrc with uv environment variables (#1541) This commit replaces .netrc with uv environment variables for installing tools from private repositories. To store credentials, I created a new and reusable settings file for the CLI in `$HOME/.config/crewai/settings.json`. The issue with .netrc files is that they are applied system-wide and are scoped by hostname, meaning we can't differentiate tool repositories requests from regular requests to CrewAI's API. * refactor: Move BaseTool to main package and centralize tool description generation (#1514) * move base_tool to main package and consolidate tool desscription generation * update import path * update tests * update doc * add base_tool test * migrate agent delegation tools to use BaseTool * update tests * update import path for tool * fix lint * update param signature * add from_langchain to BaseTool for backwards support of langchain tools * fix the case where StructuredTool doesn't have func --------- Co-authored-by: c0dez Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Update docs (#1550) * add llm providers accordion group * fix numbering * Fix directory tree & add llms to accordion * Feat/ibm memory (#1549) * Everything looks like its working. Waiting for lorenze review. * Update docs as well. * clean up for PR * add inputs to flows (#1553) * add inputs to flows * fix flows lint * Increase providers fetching timeout * Raise an error if an LLM doesnt return a response (#1548) * docs update (#1558) * add llm providers accordion group * fix numbering * Fix directory tree & add llms to accordion * update crewai enterprise link in docs * Feat/watson in cli (#1535) * getting cli and .env to work together for different models * support new models * clean up prints * Add support for cerebras * Fix watson keys * Fix flows to support cycles and added in test (#1556) * fix missing config (#1557) * making sure we don't check for agents that were not used in the crew * preparing new version * updating LLM docs * preparing new version * curring new version * preparing new version * preparing new version * add missing init * fix LiteLLM callback replacement * fix test_agent_usage_metrics_are_captured_for_hierarchical_process * removing prints * fix: Step callback issue (#1595) * fix: Step callback issue * fix: Add empty thought since its required * Cached prompt tokens on usage metrics * do not include cached on total * Fix crew_train_success test * feat: Reduce level for Bandit and fix code to adapt (#1604) * Add support for retrieving user preferences and memories using Mem0 (#1209) * Integrate Mem0 * Update src/crewai/memory/contextual/contextual_memory.py Co-authored-by: Deshraj Yadav * pending commit for _fetch_user_memories * update poetry.lock * fixes mypy issues * fix mypy checks * New fixes for user_id * remove memory_provider * handle memory_provider * checks for memory_config * add mem0 to dependency * Update pyproject.toml Co-authored-by: Deshraj Yadav * update docs * update doc * bump mem0 version * fix api error msg and mypy issue * mypy fix * resolve comments * fix memory usage without mem0 * mem0 version bump * lazy import mem0 --------- Co-authored-by: Deshraj Yadav Co-authored-by: João Moura Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * upgrade chroma and adjust embedder function generator (#1607) * upgrade chroma and adjust embedder function generator * >= version * linted * preparing enw version * adding before and after crew * Update CLI Watson supported models + docs (#1628) * docs: add gh_token documentation to GithubSearchTool * Move kickoff callbacks to crew's domain * Cassettes * Make mypy happy * Knowledge (#1567) * initial knowledge * WIP * Adding core knowledge sources * Improve types and better support for file paths * added additional sources * fix linting * update yaml to include optional deps * adding in lorenze feedback * ensure embeddings are persisted * improvements all around Knowledge class * return this * properly reset memory * properly reset memory+knowledge * consolodation and improvements * linted * cleanup rm unused embedder * fix test * fix duplicate * generating cassettes for knowledge test * updated default embedder * None embedder to use default on pipeline cloning * improvements * fixed text_file_knowledge * mypysrc fixes * type check fixes * added extra cassette * just mocks * linted * mock knowledge query to not spin up db * linted * verbose run * put a flag * fix * adding docs * better docs * improvements from review * more docs * linted * rm print * more fixes * clearer docs * added docstrings and type hints for cli --------- Co-authored-by: João Moura Co-authored-by: Lorenze Jay * Updated README.md, fix typo(s) (#1637) * Update Perplexity example in documentation (#1623) * Fix threading * preparing new version * Log in to Tool Repository on `crewai login` (#1650) This commit adds an extra step to `crewai login` to ensure users also log in to Tool Repository, that is, exchanging their Auth0 tokens for a Tool Repository username and password to be used by UV downloads and API tool uploads. * add knowledge to mint.json * Improve typed task outputs (#1651) * V1 working * clean up imports and prints * more clean up and add tests * fixing tests * fix test * fix linting * Fix tests * Fix linting * add doc string as requested by eduardo * Update Github actions (#1639) * actions/checkout@v4 * actions/cache@v4 * actions/setup-python@v5 --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * update (#1638) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * fix spelling issue found by @Jacques-Murray (#1660) * Update readme for running mypy (#1614) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Feat/remove langchain (#1654) * feat: add initial changes from langchain * feat: remove kwargs of being processed * feat: remove langchain, update uv.lock and fix type_hint * feat: change docs * feat: remove forced requirements for parameter * feat add tests for new structure tool * feat: fix tests and adapt code for args * Feat/remove langchain (#1668) * feat: add initial changes from langchain * feat: remove kwargs of being processed * feat: remove langchain, update uv.lock and fix type_hint * feat: change docs * feat: remove forced requirements for parameter * feat add tests for new structure tool * feat: fix tests and adapt code for args * fix tool calling for langchain tools * doc strings --------- Co-authored-by: Eduardo Chiarotti * added knowledge to agent level (#1655) * added knowledge to agent level * linted * added doc * added from suggestions * added test * fixes from discussion * fix docs * fix test * rm cassette for knowledge_sources test as its a mock and update agent doc string * fix test * rm unused * linted * Update Agents docs to include two approaches for creating an agent: with and without YAML configuration * Documentation Improvements: LLM Configuration and Usage (#1684) * docs: improve tasks documentation clarity and structure - Add Task Execution Flow section - Add variable interpolation explanation - Add Task Dependencies section with examples - Improve overall document structure and readability - Update code examples with proper syntax highlighting * docs: update agent documentation with improved examples and formatting - Replace DuckDuckGoSearchRun with SerperDevTool - Update code block formatting to be consistent - Improve template examples with actual syntax - Update LLM examples to use current models - Clean up formatting and remove redundant comments * docs: enhance LLM documentation with Cerebras provider and formatting improvements * docs: simplify LLMs documentation title * docs: improve installation guide clarity and structure - Add clear Python version requirements with check command - Simplify installation options to recommended method - Improve upgrade section clarity for existing users - Add better visual structure with Notes and Tips - Update description and formatting * docs: improve introduction page organization and clarity - Update organizational analogy in Note section - Improve table formatting and alignment - Remove emojis from component table for cleaner look - Add 'helps you' to make the note more action-oriented * docs: add enterprise and community cards - Add Enterprise deployment card in quickstart - Add community card focused on open source discussions - Remove deployment reference from community description - Clean up introduction page cards - Remove link from Enterprise description text * Fixes issues with result as answer not properly exiting LLM loop (#1689) * v1 of fix implemented. Need to confirm with tokens. * remove print statements * preparing new version * fix missing code in flows docs (#1690) * docs: improve tasks documentation clarity and structure - Add Task Execution Flow section - Add variable interpolation explanation - Add Task Dependencies section with examples - Improve overall document structure and readability - Update code examples with proper syntax highlighting * docs: update agent documentation with improved examples and formatting - Replace DuckDuckGoSearchRun with SerperDevTool - Update code block formatting to be consistent - Improve template examples with actual syntax - Update LLM examples to use current models - Clean up formatting and remove redundant comments * docs: enhance LLM documentation with Cerebras provider and formatting improvements * docs: simplify LLMs documentation title * docs: improve installation guide clarity and structure - Add clear Python version requirements with check command - Simplify installation options to recommended method - Improve upgrade section clarity for existing users - Add better visual structure with Notes and Tips - Update description and formatting * docs: improve introduction page organization and clarity - Update organizational analogy in Note section - Improve table formatting and alignment - Remove emojis from component table for cleaner look - Add 'helps you' to make the note more action-oriented * docs: add enterprise and community cards - Add Enterprise deployment card in quickstart - Add community card focused on open source discussions - Remove deployment reference from community description - Clean up introduction page cards - Remove link from Enterprise description text * docs: add code snippet to Getting Started section in flows.mdx --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Update reset memories command based on the SDK (#1688) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Update using langchain tools docs (#1664) * Update example of how to use LangChain tools with correct syntax * Use .env * Add Code back --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * [FEATURE] Support for custom path in RAGStorage (#1659) * added path to RAGStorage * added path to short term and entity memory * add path for long_term_storage for completeness --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * [Doc]: Add documenation for openlit observability (#1612) * Create openlit-observability.mdx * Update doc with images and steps * Update mkdocs.yml and add OpenLIT guide link --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Fix indentation in llm-connections.mdx code block (#1573) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Knowledge project directory standard (#1691) * Knowledge project directory standard * fixed types * comment fix * made base file knowledge source an abstract class * cleaner validator on model_post_init * fix type checker * cleaner refactor * better template * Update README.md (#1694) Corrected the statement which says users can not disable telemetry, but now users can disable by setting the environment variable OTEL_SDK_DISABLED to true. Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Talk about getting structured consistent outputs with tasks. * remove all references to pipeline and pipeline router (#1661) * remove all references to pipeline and router * fix linting * drop poetry.lock * docs: add nvidia as provider (#1632) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * add knowledge demo + improve knowledge docs (#1706) * Brandon/cre 509 hitl multiple rounds of followup (#1702) * v1 of HITL working * Drop print statements * HITL code more robust. Still needs to be refactored. * refactor and more clear messages * Fix type issue * fix tests * Fix test again * Drop extra print * New docs about yaml crew with decorators. Simplify template crew with… (#1701) * New docs about yaml crew with decorators. Simplify template crew with links * Fix spelling issues. * updating tools * curting new verson * Incorporate Stale PRs that have feedback (#1693) * incorporate #1683 * add in --version flag to cli. closes #1679. * Fix env issue * Add in suggestions from @caike to make sure ragstorage doesnt exceed os file limit. Also, included additional checks to support windows. * remove poetry.lock as pointed out by @sanders41 in #1574. * Incorporate feedback from crewai reviewer * Incorporate @lorenzejay feedback * drop metadata requirement (#1712) * drop metadata requirement * fix linting * Update docs for new knowledge * more linting * more linting * make save_documents private * update docs to the new way we use knowledge and include clearing memory * add support for langfuse with litellm (#1721) * docs: Add quotes to agentops installing command (#1729) * docs: Add quotes to agentops installing command * feat: Add ContextualMemory to __init__ * feat: remove import due to circular improt * feat: update tasks config main template typos * Fixed output_file not respecting system path (#1726) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * fix:typo error (#1732) * Update crew_agent_executor.py typo error * Update en.json typo error * Fix Knowledge docs Spaceflight News API dead link * call storage.search in user context search instead of memory.search (#1692) Co-authored-by: Eduardo Chiarotti * Add doc structured tool (#1713) * Add doc structured tool * Fix example --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * _execute_tool_and_check_finality 结果给回调参数,这样就可以提前拿到结果信息,去做数据解析判断做预判 (#1716) Co-authored-by: xiaohan Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * format bullet points (#1734) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Add missing @functools.wraps when wrapping functions and preserve wrapped class name in @CrewBase. (#1560) * Update annotations.py * Update utils.py * Update crew_base.py * Update utils.py * Update crew_base.py --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Fix disk I/O error when resetting short-term memory. (#1724) * Fix disk I/O error when resetting short-term memory. Reset chromadb client and nullifies references before removing directory. * Nit for clarity * did the same for knowledge_storage * cleanup * cleanup order * Cleanup after the rm of the directories --------- Co-authored-by: Lorenze Jay Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com> * restrict python version compatibility (#1731) * drop 3.13 * revert * Drop test cassette that was causing error * trying to fix failing test * adding thiago changes * resolve final tests * Drop skip * Bugfix/restrict python version compatibility (#1736) * drop 3.13 * revert * Drop test cassette that was causing error * trying to fix failing test * adding thiago changes * resolve final tests * Drop skip * drop pipeline * Update pyproject.toml and uv.lock to drop crewai-tools as a default requirement (#1711) * copy googles changes. Fix tests. Improve LLM file (#1737) * copy googles changes. Fix tests. Improve LLM file * Fix type issue * fix:typo error (#1738) * Update base_agent_tools.py typo error * Update main.py typo error * Update base_file_knowledge_source.py typo error * Update test_main.py typo error * Update en.json * Update prompts.json --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Remove manager_callbacks reference (#1741) * include event emitter in flows (#1740) * include event emitter in flows * Clean up * Fix linter * sort imports with isort rules by ruff linter (#1730) * sort imports * update --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> Co-authored-by: Eduardo Chiarotti * Added is_auto_end flag in agentops.end session in crew.py (#1320) When using agentops, we have the option to pass the `skip_auto_end_session` parameter, which is supposed to not end the session if the `end_session` function is called by Crew. Now the way it works is, the `agentops.end_session` accepts `is_auto_end` flag and crewai should have passed it as `True` (its `False` by default). I have changed the code to pass is_auto_end=True Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * NVIDIA Provider : UI changes (#1746) * docs: add nvidia as provider * nvidia ui docs changes * add note for updated list --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Fix small typo in sample tool (#1747) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Feature/add workflow permissions (#1749) * fix: Call ChromaDB reset before removing storage directory to fix disk I/O errors * feat: add workflow permissions to stale.yml * revert rag_storage.py changes * revert rag_storage.py changes --------- Co-authored-by: Matt B Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * remove pkg_resources which was causing issues (#1751) * apply agent ops changes and resolve merge conflicts (#1748) * apply agent ops changes and resolve merge conflicts * Trying to fix tests * add back in vcr * update tools * remove pkg_resources which was causing issues * Fix tests * experimenting to see if unique content is an issue with knowledge * experimenting to see if unique content is an issue with knowledge * update chromadb which seems to have issues with upsert * generate new yaml for failing test * Investigating upsert * Drop patch * Update casettes * Fix duplicate document issue * more fixes * add back in vcr * new cassette for test --------- Co-authored-by: Lorenze Jay * drop print (#1755) * Fix: CrewJSONEncoder now accepts enums (#1752) * bugfix: CrewJSONEncoder now accepts enums * sort imports --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Fix bool and null handling (#1771) * include 12 but not 13 * change to <13 instead of <=12 * Gemini 2.0 (#1773) * Update llms.mdx (Gemini 2.0) - Add Gemini 2.0 flash to Gemini table. - Add link to 2 hosting paths for Gemini in Tip. - Change to lower case model slugs vs names, user convenience. - Add https://artificialanalysis.ai/ as alternate leaderboard. - Move Gemma to "other" tab. * Update llm.py (gemini 2.0) Add setting for Gemini 2.0 context window to llm.py --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * Remove relative import in flow `main.py` template (#1782) * Add `tool.crewai.type` pyproject attribute in templates (#1789) * Correcting a small grammatical issue that was bugging me: from _satisfy the expect criteria_ to _satisfies the expected criteria_ (#1783) Signed-off-by: PJ Hagerty Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> * feat: Add task guardrails feature (#1742) * feat: Add task guardrails feature Add support for custom code guardrails in tasks that validate outputs before proceeding to the next task. Features include: - Optional task-level guardrail function - Pre-next-task execution timing - Tuple return format (success, data) - Automatic result/error routing - Configurable retry mechanism - Comprehensive documentation and tests Link to Devin run: https://app.devin.ai/sessions/39f6cfd6c5a24d25a7bd70ce070ed29a Co-Authored-By: Joe Moura * fix: Add type check for guardrail result and remove unused import Co-Authored-By: Joe Moura * fix: Remove unnecessary f-string prefix Co-Authored-By: Joe Moura * feat: Add guardrail validation improvements - Add result/error exclusivity validation in GuardrailResult - Make return type annotations optional in Task guardrail validator - Improve error messages for validation failures Co-Authored-By: Joe Moura * docs: Add comprehensive guardrails documentation - Add type hints and examples - Add error handling best practices - Add structured error response patterns - Document retry mechanisms - Improve documentation organization Co-Authored-By: Joe Moura * refactor: Update guardrail functions to handle TaskOutput objects Co-Authored-By: Joe Moura * feat: Add task guardrails feature Add support for custom code guardrails in tasks that validate outputs before proceeding to the next task. Features include: - Optional task-level guardrail function - Pre-next-task execution timing - Tuple return format (success, data) - Automatic result/error routing - Configurable retry mechanism - Comprehensive documentation and tests Link to Devin run: https://app.devin.ai/sessions/39f6cfd6c5a24d25a7bd70ce070ed29a Co-Authored-By: Joe Moura * fix: Add type check for guardrail result and remove unused import Co-Authored-By: Joe Moura * fix: Remove unnecessary f-string prefix Co-Authored-By: Joe Moura * feat: Add guardrail validation improvements - Add result/error exclusivity validation in GuardrailResult - Make return type annotations optional in Task guardrail validator - Improve error messages for validation failures Co-Authored-By: Joe Moura * docs: Add comprehensive guardrails documentation - Add type hints and examples - Add error handling best practices - Add structured error response patterns - Document retry mechanisms - Improve documentation organization Co-Authored-By: Joe Moura * refactor: Update guardrail functions to handle TaskOutput objects Co-Authored-By: Joe Moura * style: Fix import sorting in task guardrails files Co-Authored-By: Joe Moura * fixing docs * Fixing guardarils implementation * docs: Enhance guardrail validator docstring with runtime validation rationale Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> Co-authored-by: João Moura * feat: Add interpolate_only method and improve error handling (#1791) * Fixed output_file not respecting system path * Fixed yaml config is not escaped properly for output requirements * feat: Add interpolate_only method and improve error handling - Add interpolate_only method for string interpolation while preserving JSON structure - Add comprehensive test coverage for interpolate_only - Add proper type annotation for logger using ClassVar - Improve error handling and documentation for _save_file method Co-Authored-By: Joe Moura * fix: Sort imports to fix lint issues Co-Authored-By: Joe Moura * fix: Reorganize imports using ruff --fix Co-Authored-By: Joe Moura * fix: Consolidate imports and fix formatting Co-Authored-By: Joe Moura * fix: Apply ruff automatic import sorting Co-Authored-By: Joe Moura * fix: Sort imports using ruff --fix Co-Authored-By: Joe Moura --------- Co-authored-by: Frieda (Jingying) Huang Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> Co-authored-by: Frieda Huang <124417784+frieda-huang@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura * Feat/docling-support (#1763) * added tool for docling support * docling support installation * use file_paths instead of file_path * fix import * organized imports * run_type docs * needs to be list * fixed logic * logged but file_path is backwards compatible * use file_paths instead of file_path 2 * added test for multiple sources for file_paths * fix run-types * enabling local files to work and type cleanup * linted * fix test and types * fixed run types * fix types * renamed to CrewDoclingSource * linted * added docs * resolve conflicts --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> Co-authored-by: Brandon Hancock * removed some redundancies (#1796) * removed some redundancies * cleanup * Feat/joao flow improvement requests (#1795) * Add in or and and in router * In the middle of improving plotting * final plot changes --------- Co-authored-by: João Moura * Adding Multimodal Abilities to Crew (#1805) * initial fix on delegation tools * fixing tests for delegations and coding * Refactor prepare tool and adding initial add images logic * supporting image tool * fixing linter * fix linter * Making sure multimodal feature support i18n * fix linter and types * mixxing translations * fix types and linter * Revert "fixing linter" This reverts commit ef323e3487e62ee4f5bce7f86378068a5ac77e16. * fix linters * test * fix * fix * fix linter * fix * ignore * type improvements * chore: removing crewai-tools from dev-dependencies (#1760) As mentioned in issue #1759, listing crewai-tools as dev-dependencies makes pip install it a required dependency, and not an optional Co-authored-by: João Moura * docs: add guide for multimodal agents (#1807) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura * Portkey Integration with CrewAI (#1233) * Create Portkey-Observability-and-Guardrails.md * crewAI update with new changes * small change --------- Co-authored-by: siddharthsambharia-portkey Co-authored-by: João Moura * fix: Change storage initialization to None for KnowledgeStorage (#1804) * fix: Change storage initialization to None for KnowledgeStorage * refactor: Change storage field to optional and improve error handling when saving documents --------- Co-authored-by: João Moura * fix: handle optional storage with null checks (#1808) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: João Moura * docs: update README to highlight Flows (#1809) * docs: highlight Flows feature in README Co-Authored-By: Joe Moura * docs: enhance README with LangGraph comparison and flows-crews synergy Co-Authored-By: Joe Moura * docs: replace initial Flow example with advanced Flow+Crew example; enhance LangGraph comparison Co-Authored-By: Joe Moura * docs: incorporate key terms and enhance feature descriptions Co-Authored-By: Joe Moura * docs: refine technical language, enhance feature descriptions, fix string interpolation Co-Authored-By: Joe Moura * docs: update README with performance metrics, feature enhancements, and course links Co-Authored-By: Joe Moura * docs: update LangGraph comparison with paragraph and P.S. section Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura * Update README.md * docs: add agent-specific knowledge documentation and examples (#1811) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura * fixing file paths for knowledge source * Fix interpolation for output_file in Task (#1803) (#1814) * fix: interpolate output_file attribute from YAML Co-Authored-By: Joe Moura * fix: add security validation for output_file paths Co-Authored-By: Joe Moura * fix: add _original_output_file private attribute to fix type-checker error Co-Authored-By: Joe Moura * fix: update interpolate_only to handle None inputs and remove duplicate attribute Co-Authored-By: Joe Moura * fix: improve output_file validation and error messages Co-Authored-By: Joe Moura * test: add end-to-end tests for output_file functionality Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura * fix(manager_llm): handle coworker role name case/whitespace properly (#1820) * fix(manager_llm): handle coworker role name case/whitespace properly - Add .strip() to agent name and role comparisons in base_agent_tools.py - Add test case for varied role name cases and whitespace - Fix issue #1503 with manager LLM delegation Co-Authored-By: Joe Moura * fix(manager_llm): improve error handling and add debug logging - Add debug logging for better observability - Add sanitize_agent_name helper method - Enhance error messages with more context - Add parameterized tests for edge cases: - Embedded quotes - Trailing newlines - Multiple whitespace - Case variations - None values - Improve error handling with specific exceptions Co-Authored-By: Joe Moura * style: fix import sorting in base_agent_tools and test_manager_llm_delegation Co-Authored-By: Joe Moura * fix(manager_llm): improve whitespace normalization in role name matching Co-Authored-By: Joe Moura * style: fix import sorting in base_agent_tools and test_manager_llm_delegation Co-Authored-By: Joe Moura * fix(manager_llm): add error message template for agent tool execution errors Co-Authored-By: Joe Moura * style: fix import sorting in test_manager_llm_delegation.py Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura * fix: add tiktoken as explicit dependency and document Rust requirement (#1826) * feat: add tiktoken as explicit dependency and document Rust requirement - Add tiktoken>=0.8.0 as explicit dependency to ensure pre-built wheels are used - Document Rust compiler requirement as fallback in README.md - Addresses issue #1824 tiktoken build failure Co-Authored-By: Joe Moura * fix: adjust tiktoken version to ~=0.7.0 for dependency compatibility - Update tiktoken dependency to ~=0.7.0 to resolve conflict with embedchain - Maintain compatibility with crewai-tools dependency chain - Addresses CI build failures Co-Authored-By: Joe Moura * docs: add troubleshooting section and make tiktoken optional Co-Authored-By: Joe Moura * Update README.md --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura Co-authored-by: João Moura * Docstring, Error Handling, and Type Hints Improvements (#1828) * docs: add comprehensive docstrings to Flow class and methods - Added NumPy-style docstrings to all decorator functions - Added detailed documentation to Flow class methods - Included parameter types, return types, and examples - Enhanced documentation clarity and completeness Co-Authored-By: Joe Moura * feat: add secure path handling utilities - Add path_utils.py with safe path handling functions - Implement path validation and security checks - Integrate secure path handling in flow_visualizer.py - Add path validation in html_template_handler.py - Add comprehensive error handling for path operations Co-Authored-By: Joe Moura * docs: add comprehensive docstrings and type hints to flow utils (#1819) Co-Authored-By: Joe Moura * fix: add type annotations and fix import sorting Co-Authored-By: Joe Moura * fix: add type annotations to flow utils and visualization utils Co-Authored-By: Joe Moura * fix: resolve import sorting and type annotation issues Co-Authored-By: Joe Moura * fix: properly initialize and update edge_smooth variable Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura * feat: add docstring (#1819) Co-authored-by: João Moura * fix: Include agent knowledge in planning process (#1818) * test: Add test demonstrating knowledge not included in planning process Issue #1703: Add test to verify that agent knowledge sources are not currently included in the planning process. This test will help validate the fix once implemented. - Creates agent with knowledge sources - Verifies knowledge context missing from planning - Checks other expected components are present Co-Authored-By: Joe Moura * fix: Include agent knowledge in planning process Issue #1703: Integrate agent knowledge sources into planning summaries - Add agent_knowledge field to task summaries in planning_handler - Update test to verify knowledge inclusion - Ensure knowledge context is available during planning phase The planning agent now has access to agent knowledge when creating task execution plans, allowing for better informed planning decisions. Co-Authored-By: Joe Moura * style: Fix import sorting in test_knowledge_planning.py - Reorganize imports according to ruff linting rules - Fix I001 linting error Co-Authored-By: Joe Moura * test: Update task summary assertions to include knowledge field Co-Authored-By: Joe Moura * fix: Update ChromaDB mock path and fix knowledge string formatting Co-Authored-By: Joe Moura * fix: Improve knowledge integration in planning process with error handling Co-Authored-By: Joe Moura * fix: Update task summary format for empty tools and knowledge - Change empty tools message to 'agent has no tools' - Remove agent_knowledge field when empty - Update test assertions to match new format - Improve test messages for clarity Co-Authored-By: Joe Moura * fix: Update string formatting for agent tools in task summary Co-Authored-By: Joe Moura * fix: Update string formatting for agent tools in task summary Co-Authored-By: Joe Moura * fix: Update string formatting for agent tools and knowledge in task summary Co-Authored-By: Joe Moura * fix: Update knowledge field formatting in task summary Co-Authored-By: Joe Moura * style: Fix import sorting in test_planning_handler.py Co-Authored-By: Joe Moura * style: Fix import sorting order in test_planning_handler.py Co-Authored-By: Joe Moura * test: Add ChromaDB mocking to test_create_tasks_summary_with_knowledge_and_tools Co-Authored-By: Joe Moura --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura Co-authored-by: João Moura * Suppressed userWarnings from litellm pydantic issues (#1833) * Suppressed userWarnings from litellm pydantic issues * change litellm version * Fix failling ollama tasks * Trying out timeouts * Trying out timeouts * trying next crew_test timeout * trying next crew_test timeout * timeout in crew_tests * timeout in crew_tests * more timeouts * more timeouts * crew_test changes werent applied * crew_test changes werent applied * revert uv.lock * revert uv.lock * add back in crewai tool dependencies and drop litellm version * add back in crewai tool dependencies and drop litellm version * tests should work now * tests should work now * more test changes * more test changes * Reverting uv.lock and pyproject * Reverting uv.lock and pyproject * Update llama3 cassettes * Update llama3 cassettes * sync packages with uv.lock * sync packages with uv.lock * more test fixes * fix tets * drop large file * final clean up * drop record new episodes --------- Signed-off-by: PJ Hagerty Co-authored-by: Thiago Moretto <168731+thiagomoretto@users.noreply.github.com> Co-authored-by: Thiago Moretto Co-authored-by: Vini Brasil Co-authored-by: Guilherme de Amorim Co-authored-by: Tony Kipkemboi Co-authored-by: Eren Küçüker <66262604+erenkucuker@users.noreply.github.com> Co-authored-by: João Moura Co-authored-by: Akesh kumar <155313882+akesh-0909@users.noreply.github.com> Co-authored-by: Lennex Zinyando Co-authored-by: Shahar Yair Co-authored-by: Eduardo Chiarotti Co-authored-by: Stephen Hankinson Co-authored-by: Muhammad Noman Fareed <60171953+shnoman97@users.noreply.github.com> Co-authored-by: dbubel <50341559+dbubel@users.noreply.github.com> Co-authored-by: Rip&Tear <84775494+theCyberTech@users.noreply.github.com> Co-authored-by: Rok Benko <115651717+rokbenko@users.noreply.github.com> Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com> Co-authored-by: Sam Co-authored-by: Maicon Peixinho Co-authored-by: Robin Wang <6220861+MottoX@users.noreply.github.com> Co-authored-by: C0deZ Co-authored-by: c0dez Co-authored-by: Gui Vieira Co-authored-by: Dev Khant Co-authored-by: Deshraj Yadav Co-authored-by: Gui Vieira Co-authored-by: Lorenze Jay Co-authored-by: Bob Conan Co-authored-by: Andy Bromberg Co-authored-by: Bowen Liang Co-authored-by: Ivan Peevski <133036+ipeevski@users.noreply.github.com> Co-authored-by: Rok Benko Co-authored-by: Javier Saldaña Co-authored-by: Ola Hungerford Co-authored-by: Tom Mahler, PhD Co-authored-by: Patcher Co-authored-by: Feynman Liang Co-authored-by: Stephen Co-authored-by: Rashmi Pawar <168514198+raspawar@users.noreply.github.com> Co-authored-by: Frieda Huang <124417784+frieda-huang@users.noreply.github.com> Co-authored-by: Archkon <180910180+Archkon@users.noreply.github.com> Co-authored-by: Aviral Jain Co-authored-by: lgesuellip <102637283+lgesuellip@users.noreply.github.com> Co-authored-by: fuckqqcom <9391575+fuckqqcom@users.noreply.github.com> Co-authored-by: xiaohan Co-authored-by: Piotr Mardziel Co-authored-by: Carlos Souza Co-authored-by: Paul Cowgill Co-authored-by: Bowen Liang Co-authored-by: Anmol Deep Co-authored-by: André Lago Co-authored-by: Matt B Co-authored-by: Karan Vaidya Co-authored-by: alan blount Co-authored-by: PJ Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura Co-authored-by: Frieda (Jingying) Huang Co-authored-by: João Igor Co-authored-by: siddharth Sambharia Co-authored-by: siddharthsambharia-portkey Co-authored-by: Erick Amorim <73451993+ericklima-ca@users.noreply.github.com> Co-authored-by: Marco Vinciguerra <88108002+VinciGit00@users.noreply.github.com> --- pyproject.toml | 2 +- tests/agent_test.py | 6 +- .../test_agent_execute_task_with_ollama.yaml | 864 +---------------- .../test_agent_with_ollama_llama3.yaml | 867 +----------------- .../test_llm_call_with_ollama_llama3.yaml | 453 +-------- tests/cli/tools/test_main.py | 9 +- tests/crew_test.py | 280 +++--- tests/knowledge/knowledge_test.py | 10 +- tests/task_test.py | 79 +- tests/test_manager_llm_delegation.py | 55 +- tests/test_task_guardrails.py | 27 +- uv.lock | 52 +- 12 files changed, 346 insertions(+), 2358 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 10d7ea62d..bcc00a0d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ # Core Dependencies "pydantic>=2.4.2", "openai>=1.13.3", - "litellm>=1.56.4", + "litellm>=1.44.22", "instructor>=1.3.3", # Text Processing diff --git a/tests/agent_test.py b/tests/agent_test.py index 679f4832e..c490a5e13 100644 --- a/tests/agent_test.py +++ b/tests/agent_test.py @@ -1457,7 +1457,7 @@ def test_agent_with_ollama_llama3(): assert agent.llm.model == "ollama/llama3.2:3b" assert agent.llm.base_url == "http://localhost:11434" - task = "Respond in 20 words. Who are you?" + task = "Respond in 20 words. Which model are you?" response = agent.llm.call([{"role": "user", "content": task}]) assert response @@ -1473,7 +1473,9 @@ def test_llm_call_with_ollama_llama3(): temperature=0.7, max_tokens=30, ) - messages = [{"role": "user", "content": "Respond in 20 words. Who are you?"}] + messages = [ + {"role": "user", "content": "Respond in 20 words. Which model are you?"} + ] response = llm.call(messages) diff --git a/tests/cassettes/test_agent_execute_task_with_ollama.yaml b/tests/cassettes/test_agent_execute_task_with_ollama.yaml index 8228b53a7..d8ecb4dde 100644 --- a/tests/cassettes/test_agent_execute_task_with_ollama.yaml +++ b/tests/cassettes/test_agent_execute_task_with_ollama.yaml @@ -12,862 +12,34 @@ interactions: available and give your best Final Answer, your job depends on it!\n\nThought:\n\n", "options": {"stop": ["\nObservation:"]}, "stream": false}' headers: - accept: + Accept: - '*/*' - accept-encoding: + Accept-Encoding: - gzip, deflate - connection: + Connection: - keep-alive - content-length: + Content-Length: - '839' - host: - - localhost:11434 - user-agent: - - litellm/1.56.4 + Content-Type: + - application/json + User-Agent: + - python-requests/2.32.3 method: POST uri: http://localhost:11434/api/generate response: - content: '{"model":"llama3.2:3b","created_at":"2024-12-31T16:56:15.759718Z","response":"Final - Answer: Artificial Intelligence (AI) refers to the development of computer systems - able to perform tasks that typically require human intelligence, including learning, - problem-solving, decision-making, and perception.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,744,512,2675,527,1296,3560,13,1296,93371,198,7927,4443,5915,374,25,1296,5915,198,1271,3041,856,1888,4686,1620,4320,311,279,3465,1005,279,4839,2768,3645,1473,85269,25,358,1457,649,3041,264,2294,4320,198,19918,22559,25,4718,1620,4320,2011,387,279,2294,323,279,1455,4686,439,3284,11,433,2011,387,15632,7633,382,40,28832,1005,1521,20447,11,856,2683,14117,389,433,2268,14711,2724,1473,5520,5546,25,83017,1148,15592,374,304,832,11914,271,2028,374,279,1755,13186,369,701,1620,4320,25,362,832,1355,18886,16540,315,15592,198,9514,28832,471,279,5150,4686,2262,439,279,1620,4320,11,539,264,12399,382,11382,0,1115,374,48174,3062,311,499,11,1005,279,7526,2561,323,3041,701,1888,13321,22559,11,701,2683,14117,389,433,2268,85269,1473,128009,128006,78191,128007,271,19918,22559,25,59294,22107,320,15836,8,19813,311,279,4500,315,6500,6067,3025,311,2804,9256,430,11383,1397,3823,11478,11,2737,6975,11,3575,99246,11,5597,28846,11,323,21063,13],"total_duration":1156303250,"load_duration":35999125,"prompt_eval_count":181,"prompt_eval_duration":408000000,"eval_count":38,"eval_duration":711000000}' + body: + string: '{"model":"llama3.2:3b","created_at":"2025-01-02T20:05:52.24992Z","response":"Final + Answer: Artificial Intelligence (AI) refers to the development of computer + systems capable of performing tasks that typically require human intelligence, + such as learning, problem-solving, decision-making, and perception.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,744,512,2675,527,1296,3560,13,1296,93371,198,7927,4443,5915,374,25,1296,5915,198,1271,3041,856,1888,4686,1620,4320,311,279,3465,1005,279,4839,2768,3645,1473,85269,25,358,1457,649,3041,264,2294,4320,198,19918,22559,25,4718,1620,4320,2011,387,279,2294,323,279,1455,4686,439,3284,11,433,2011,387,15632,7633,382,40,28832,1005,1521,20447,11,856,2683,14117,389,433,2268,14711,2724,1473,5520,5546,25,83017,1148,15592,374,304,832,11914,271,2028,374,279,1755,13186,369,701,1620,4320,25,362,832,1355,18886,16540,315,15592,198,9514,28832,471,279,5150,4686,2262,439,279,1620,4320,11,539,264,12399,382,11382,0,1115,374,48174,3062,311,499,11,1005,279,7526,2561,323,3041,701,1888,13321,22559,11,701,2683,14117,389,433,2268,85269,1473,128009,128006,78191,128007,271,19918,22559,25,59294,22107,320,15836,8,19813,311,279,4500,315,6500,6067,13171,315,16785,9256,430,11383,1397,3823,11478,11,1778,439,6975,11,3575,99246,11,5597,28846,11,323,21063,13],"total_duration":1461909875,"load_duration":39886208,"prompt_eval_count":181,"prompt_eval_duration":701000000,"eval_count":39,"eval_duration":719000000}' headers: Content-Length: - - '1528' + - '1537' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 31 Dec 2024 16:56:15 GMT - http_version: HTTP/1.1 - status_code: 200 -- request: - body: '{"name": "llama3.2:3b"}' - headers: - accept: - - '*/*' - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '23' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - litellm/1.56.4 - method: POST - uri: http://localhost:11434/api/show - response: - content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version - Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms - and conditions for use, reproduction, distribution \\nand modification of the - Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, - manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed - to promoting safe and fair use of its tools and features, including Llama 3.2. - If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). - The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama - show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# - FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE - \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER - stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE - \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: - September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions - for use, reproduction, distribution \\nand modification of the Llama Materials - set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals - and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta - is committed to promoting safe and fair use of its tools and features, including - Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use - Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be - found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop - \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" - headers: - Content-Type: - - application/json; charset=utf-8 - Date: - - Tue, 31 Dec 2024 16:56:15 GMT - Transfer-Encoding: - - chunked - http_version: HTTP/1.1 - status_code: 200 -- request: - body: '{"name": "llama3.2:3b"}' - headers: - accept: - - '*/*' - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '23' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - litellm/1.56.4 - method: POST - uri: http://localhost:11434/api/show - response: - content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version - Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms - and conditions for use, reproduction, distribution \\nand modification of the - Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, - manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed - to promoting safe and fair use of its tools and features, including Llama 3.2. - If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). - The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama - show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# - FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE - \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER - stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE - \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: - September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions - for use, reproduction, distribution \\nand modification of the Llama Materials - set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals - and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta - is committed to promoting safe and fair use of its tools and features, including - Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use - Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be - found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop - \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" - headers: - Content-Type: - - application/json; charset=utf-8 - Date: - - Tue, 31 Dec 2024 16:56:15 GMT - Transfer-Encoding: - - chunked - http_version: HTTP/1.1 - status_code: 200 + - Thu, 02 Jan 2025 20:05:52 GMT + status: + code: 200 + message: OK version: 1 diff --git a/tests/cassettes/test_agent_with_ollama_llama3.yaml b/tests/cassettes/test_agent_with_ollama_llama3.yaml index a85abddf2..beb146254 100644 --- a/tests/cassettes/test_agent_with_ollama_llama3.yaml +++ b/tests/cassettes/test_agent_with_ollama_llama3.yaml @@ -1,863 +1,36 @@ interactions: - request: body: '{"model": "llama3.2:3b", "prompt": "### User:\nRespond in 20 words. Who - are you?\n\n", "options": {"stop": ["\nObservation:"]}, "stream": false}' + which model are you?\n\n", "options": {"stop": ["\nObservation:"]}, "stream": + false}' headers: - accept: + Accept: - '*/*' - accept-encoding: + Accept-Encoding: - gzip, deflate - connection: + Connection: - keep-alive - content-length: - - '144' - host: - - localhost:11434 - user-agent: - - litellm/1.56.4 + Content-Length: + - '156' + Content-Type: + - application/json + User-Agent: + - python-requests/2.32.3 method: POST uri: http://localhost:11434/api/generate response: - content: '{"model":"llama3.2:3b","created_at":"2024-12-31T16:57:54.063894Z","response":"I''m - an AI designed to provide information and assist with inquiries, while maintaining - a neutral and respectful tone always.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,2724,512,66454,304,220,508,4339,13,10699,527,499,1980,128009,128006,78191,128007,271,40,2846,459,15592,6319,311,3493,2038,323,7945,449,44983,11,1418,20958,264,21277,323,49150,16630,2744,13],"total_duration":651386042,"load_duration":41061917,"prompt_eval_count":38,"prompt_eval_duration":204000000,"eval_count":23,"eval_duration":405000000}' + body: + string: '{"model":"llama3.2:3b","created_at":"2025-01-02T20:07:07.623404Z","response":"I''m + an AI designed to assist and communicate with users, utilizing a combination + of natural language processing models.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,2724,512,66454,304,220,508,4339,13,10699,902,1646,527,499,1980,128009,128006,78191,128007,271,40,2846,459,15592,6319,311,7945,323,19570,449,3932,11,35988,264,10824,315,5933,4221,8863,4211,13],"total_duration":1076617833,"load_duration":46505416,"prompt_eval_count":40,"prompt_eval_duration":626000000,"eval_count":22,"eval_duration":399000000}' headers: Content-Length: - - '692' + - '690' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 31 Dec 2024 16:57:54 GMT - http_version: HTTP/1.1 - status_code: 200 -- request: - body: '{"name": "llama3.2:3b"}' - headers: - accept: - - '*/*' - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '23' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - litellm/1.56.4 - method: POST - uri: http://localhost:11434/api/show - response: - content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version - Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms - and conditions for use, reproduction, distribution \\nand modification of the - Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, - manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed - to promoting safe and fair use of its tools and features, including Llama 3.2. - If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). - The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama - show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# - FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE - \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER - stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE - \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: - September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions - for use, reproduction, distribution \\nand modification of the Llama Materials - set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals - and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta - is committed to promoting safe and fair use of its tools and features, including - Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use - Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be - found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop - \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" - headers: - Content-Type: - - application/json; charset=utf-8 - Date: - - Tue, 31 Dec 2024 16:57:54 GMT - Transfer-Encoding: - - chunked - http_version: HTTP/1.1 - status_code: 200 -- request: - body: '{"name": "llama3.2:3b"}' - headers: - accept: - - '*/*' - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '23' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - litellm/1.56.4 - method: POST - uri: http://localhost:11434/api/show - response: - content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version - Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms - and conditions for use, reproduction, distribution \\nand modification of the - Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, - manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed - to promoting safe and fair use of its tools and features, including Llama 3.2. - If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). - The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama - show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# - FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE - \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER - stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE - \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: - September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions - for use, reproduction, distribution \\nand modification of the Llama Materials - set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals - and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta - is committed to promoting safe and fair use of its tools and features, including - Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use - Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be - found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop - \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" - headers: - Content-Type: - - application/json; charset=utf-8 - Date: - - Tue, 31 Dec 2024 16:57:54 GMT - Transfer-Encoding: - - chunked - http_version: HTTP/1.1 - status_code: 200 + - Thu, 02 Jan 2025 20:07:07 GMT + status: + code: 200 + message: OK version: 1 diff --git a/tests/cassettes/test_llm_call_with_ollama_llama3.yaml b/tests/cassettes/test_llm_call_with_ollama_llama3.yaml index 0cc413ca3..c1cee2cc8 100644 --- a/tests/cassettes/test_llm_call_with_ollama_llama3.yaml +++ b/tests/cassettes/test_llm_call_with_ollama_llama3.yaml @@ -1,449 +1,36 @@ interactions: - request: - body: '{"model": "llama3.2:3b", "prompt": "### User:\nRespond in 20 words. Who - are you?\n\n", "options": {"temperature": 0.7, "num_predict": 30}, "stream": + body: '{"model": "llama3.2:3b", "prompt": "### User:\nRespond in 20 words. Which + model are you??\n\n", "options": {"num_predict": 30, "temperature": 0.7}, "stream": false}' headers: - accept: + Accept: - '*/*' - accept-encoding: + Accept-Encoding: - gzip, deflate - connection: + Connection: - keep-alive - content-length: - - '155' - host: - - localhost:11434 - user-agent: - - litellm/1.56.4 + Content-Length: + - '164' + Content-Type: + - application/json + User-Agent: + - python-requests/2.32.3 method: POST uri: http://localhost:11434/api/generate response: - content: '{"model":"llama3.2:3b","created_at":"2024-12-31T17:00:06.295261Z","response":"I''m - an AI assistant, here to provide information and answer questions to the best - of my abilities and knowledge.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,2724,512,66454,304,220,508,4339,13,10699,527,499,1980,128009,128006,78191,128007,271,40,2846,459,15592,18328,11,1618,311,3493,2038,323,4320,4860,311,279,1888,315,856,18000,323,6677,13],"total_duration":826912750,"load_duration":32648125,"prompt_eval_count":38,"prompt_eval_duration":389000000,"eval_count":23,"eval_duration":404000000}' + body: + string: '{"model":"llama3.2:3b","created_at":"2025-01-02T20:24:24.812595Z","response":"I''m + an AI, specifically a large language model, designed to understand and respond + to user queries with accuracy.","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,2724,512,66454,304,220,508,4339,13,16299,1646,527,499,71291,128009,128006,78191,128007,271,40,2846,459,15592,11,11951,264,3544,4221,1646,11,6319,311,3619,323,6013,311,1217,20126,449,13708,13],"total_duration":827817584,"load_duration":41560542,"prompt_eval_count":39,"prompt_eval_duration":384000000,"eval_count":23,"eval_duration":400000000}' headers: Content-Length: - - '675' + - '683' Content-Type: - application/json; charset=utf-8 Date: - - Tue, 31 Dec 2024 17:00:06 GMT - http_version: HTTP/1.1 - status_code: 200 -- request: - body: '{"name": "llama3.2:3b"}' - headers: - accept: - - '*/*' - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '23' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - litellm/1.56.4 - method: POST - uri: http://localhost:11434/api/show - response: - content: "{\"license\":\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version - Release Date: September 25, 2024\\n\\n\u201CAgreement\u201D means the terms - and conditions for use, reproduction, distribution \\nand modification of the - Llama Materials set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, - manuals and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\n**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta is committed - to promoting safe and fair use of its tools and features, including Llama 3.2. - If you access or use Llama 3.2, you agree to this Acceptable Use Policy (\u201C**Policy**\u201D). - The most recent copy of this policy can be found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\",\"modelfile\":\"# Modelfile generated by \\\"ollama - show\\\"\\n# To build a new Modelfile based on this, replace FROM with:\\n# - FROM llama3.2:3b\\n\\nFROM /Users/brandonhancock/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff\\nTEMPLATE - \\\"\\\"\\\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\\\"\\\"\\\"\\nPARAMETER stop \\u003c|start_header_id|\\u003e\\nPARAMETER - stop \\u003c|end_header_id|\\u003e\\nPARAMETER stop \\u003c|eot_id|\\u003e\\nLICENSE - \\\"LLAMA 3.2 COMMUNITY LICENSE AGREEMENT\\nLlama 3.2 Version Release Date: - September 25, 2024\\n\\n\u201CAgreement\u201D means the terms and conditions - for use, reproduction, distribution \\nand modification of the Llama Materials - set forth herein.\\n\\n\u201CDocumentation\u201D means the specifications, manuals - and documentation accompanying Llama 3.2\\ndistributed by Meta at https://llama.meta.com/doc/overview.\\n\\n\u201CLicensee\u201D - or \u201Cyou\u201D means you, or your employer or any other person or entity - (if you are \\nentering into this Agreement on such person or entity\u2019s - behalf), of the age required under\\napplicable laws, rules or regulations to - provide legal consent and that has legal authority\\nto bind your employer or - such other person or entity if you are entering in this Agreement\\non their - behalf.\\n\\n\u201CLlama 3.2\u201D means the foundational large language models - and software and algorithms, including\\nmachine-learning model code, trained - model weights, inference-enabling code, training-enabling code,\\nfine-tuning - enabling code and other elements of the foregoing distributed by Meta at \\nhttps://www.llama.com/llama-downloads.\\n\\n\u201CLlama - Materials\u201D means, collectively, Meta\u2019s proprietary Llama 3.2 and Documentation - (and \\nany portion thereof) made available under this Agreement.\\n\\n\u201CMeta\u201D - or \u201Cwe\u201D means Meta Platforms Ireland Limited (if you are located in - or, \\nif you are an entity, your principal place of business is in the EEA - or Switzerland) \\nand Meta Platforms, Inc. (if you are located outside of the - EEA or Switzerland). \\n\\n\\nBy clicking \u201CI Accept\u201D below or by using - or distributing any portion or element of the Llama Materials,\\nyou agree to - be bound by this Agreement.\\n\\n\\n1. License Rights and Redistribution.\\n\\n - \ a. Grant of Rights. You are granted a non-exclusive, worldwide, \\nnon-transferable - and royalty-free limited license under Meta\u2019s intellectual property or - other rights \\nowned by Meta embodied in the Llama Materials to use, reproduce, - distribute, copy, create derivative works \\nof, and make modifications to the - Llama Materials. \\n\\n b. Redistribution and Use. \\n\\n i. If - you distribute or make available the Llama Materials (or any derivative works - thereof), \\nor a product or service (including another AI model) that contains - any of them, you shall (A) provide\\na copy of this Agreement with any such - Llama Materials; and (B) prominently display \u201CBuilt with Llama\u201D\\non - a related website, user interface, blogpost, about page, or product documentation. - If you use the\\nLlama Materials or any outputs or results of the Llama Materials - to create, train, fine tune, or\\notherwise improve an AI model, which is distributed - or made available, you shall also include \u201CLlama\u201D\\nat the beginning - of any such AI model name.\\n\\n ii. If you receive Llama Materials, - or any derivative works thereof, from a Licensee as part\\nof an integrated - end user product, then Section 2 of this Agreement will not apply to you. \\n\\n - \ iii. You must retain in all copies of the Llama Materials that you distribute - the \\nfollowing attribution notice within a \u201CNotice\u201D text file distributed - as a part of such copies: \\n\u201CLlama 3.2 is licensed under the Llama 3.2 - Community License, Copyright \xA9 Meta Platforms,\\nInc. All Rights Reserved.\u201D\\n\\n - \ iv. Your use of the Llama Materials must comply with applicable laws - and regulations\\n(including trade compliance laws and regulations) and adhere - to the Acceptable Use Policy for\\nthe Llama Materials (available at https://www.llama.com/llama3_2/use-policy), - which is hereby \\nincorporated by reference into this Agreement.\\n \\n2. - Additional Commercial Terms. If, on the Llama 3.2 version release date, the - monthly active users\\nof the products or services made available by or for - Licensee, or Licensee\u2019s affiliates, \\nis greater than 700 million monthly - active users in the preceding calendar month, you must request \\na license - from Meta, which Meta may grant to you in its sole discretion, and you are not - authorized to\\nexercise any of the rights under this Agreement unless or until - Meta otherwise expressly grants you such rights.\\n\\n3. Disclaimer of Warranty. - UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND \\nRESULTS - THEREFROM ARE PROVIDED ON AN \u201CAS IS\u201D BASIS, WITHOUT WARRANTIES OF - ANY KIND, AND META DISCLAIMS\\nALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND - IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\\nOF TITLE, NON-INFRINGEMENT, - MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE\\nFOR - DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS - AND ASSUME ANY RISKS ASSOCIATED\\nWITH YOUR USE OF THE LLAMA MATERIALS AND ANY - OUTPUT AND RESULTS.\\n\\n4. Limitation of Liability. IN NO EVENT WILL META OR - ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, \\nWHETHER IN CONTRACT, - TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, - \\nFOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, - EXEMPLARY OR PUNITIVE DAMAGES, EVEN \\nIF META OR ITS AFFILIATES HAVE BEEN ADVISED - OF THE POSSIBILITY OF ANY OF THE FOREGOING.\\n\\n5. Intellectual Property.\\n\\n - \ a. No trademark licenses are granted under this Agreement, and in connection - with the Llama Materials, \\nneither Meta nor Licensee may use any name or mark - owned by or associated with the other or any of its affiliates, \\nexcept as - required for reasonable and customary use in describing and redistributing the - Llama Materials or as \\nset forth in this Section 5(a). Meta hereby grants - you a license to use \u201CLlama\u201D (the \u201CMark\u201D) solely as required - \\nto comply with the last sentence of Section 1.b.i. You will comply with Meta\u2019s - brand guidelines (currently accessible \\nat https://about.meta.com/brand/resources/meta/company-brand/). - All goodwill arising out of your use of the Mark \\nwill inure to the benefit - of Meta.\\n\\n b. Subject to Meta\u2019s ownership of Llama Materials and - derivatives made by or for Meta, with respect to any\\n derivative works - and modifications of the Llama Materials that are made by you, as between you - and Meta,\\n you are and will be the owner of such derivative works and modifications.\\n\\n - \ c. If you institute litigation or other proceedings against Meta or any - entity (including a cross-claim or\\n counterclaim in a lawsuit) alleging - that the Llama Materials or Llama 3.2 outputs or results, or any portion\\n - \ of any of the foregoing, constitutes infringement of intellectual property - or other rights owned or licensable\\n by you, then any licenses granted - to you under this Agreement shall terminate as of the date such litigation or\\n - \ claim is filed or instituted. You will indemnify and hold harmless Meta - from and against any claim by any third\\n party arising out of or related - to your use or distribution of the Llama Materials.\\n\\n6. Term and Termination. - The term of this Agreement will commence upon your acceptance of this Agreement - or access\\nto the Llama Materials and will continue in full force and effect - until terminated in accordance with the terms\\nand conditions herein. Meta - may terminate this Agreement if you are in breach of any term or condition of - this\\nAgreement. Upon termination of this Agreement, you shall delete and cease - use of the Llama Materials. Sections 3,\\n4 and 7 shall survive the termination - of this Agreement. \\n\\n7. Governing Law and Jurisdiction. This Agreement will - be governed and construed under the laws of the State of \\nCalifornia without - regard to choice of law principles, and the UN Convention on Contracts for the - International\\nSale of Goods does not apply to this Agreement. The courts of - California shall have exclusive jurisdiction of\\nany dispute arising out of - this Agreement.\\\"\\nLICENSE \\\"**Llama 3.2** **Acceptable Use Policy**\\n\\nMeta - is committed to promoting safe and fair use of its tools and features, including - Llama 3.2. If you access or use Llama 3.2, you agree to this Acceptable Use - Policy (\u201C**Policy**\u201D). The most recent copy of this policy can be - found at [https://www.llama.com/llama3_2/use-policy](https://www.llama.com/llama3_2/use-policy).\\n\\n**Prohibited - Uses**\\n\\nWe want everyone to use Llama 3.2 safely and responsibly. You agree - you will not use, or allow others to use, Llama 3.2 to:\\n\\n\\n\\n1. Violate - the law or others\u2019 rights, including to:\\n 1. Engage in, promote, generate, - contribute to, encourage, plan, incite, or further illegal or unlawful activity - or content, such as:\\n 1. Violence or terrorism\\n 2. Exploitation - or harm to children, including the solicitation, creation, acquisition, or dissemination - of child exploitative content or failure to report Child Sexual Abuse Material\\n - \ 3. Human trafficking, exploitation, and sexual violence\\n 4. - The illegal distribution of information or materials to minors, including obscene - materials, or failure to employ legally required age-gating in connection with - such information or materials.\\n 5. Sexual solicitation\\n 6. - Any other criminal activity\\n 1. Engage in, promote, incite, or facilitate - the harassment, abuse, threatening, or bullying of individuals or groups of - individuals\\n 2. Engage in, promote, incite, or facilitate discrimination - or other unlawful or harmful conduct in the provision of employment, employment - benefits, credit, housing, other economic benefits, or other essential goods - and services\\n 3. Engage in the unauthorized or unlicensed practice of any - profession including, but not limited to, financial, legal, medical/health, - or related professional practices\\n 4. Collect, process, disclose, generate, - or infer private or sensitive information about individuals, including information - about individuals\u2019 identity, health, or demographic information, unless - you have obtained the right to do so in accordance with applicable law\\n 5. - Engage in or facilitate any action or generate any content that infringes, misappropriates, - or otherwise violates any third-party rights, including the outputs or results - of any products or services using the Llama Materials\\n 6. Create, generate, - or facilitate the creation of malicious code, malware, computer viruses or do - anything else that could disable, overburden, interfere with or impair the proper - working, integrity, operation or appearance of a website or computer system\\n - \ 7. Engage in any action, or facilitate any action, to intentionally circumvent - or remove usage restrictions or other safety measures, or to enable functionality - disabled by Meta\\n2. Engage in, promote, incite, facilitate, or assist in the - planning or development of activities that present a risk of death or bodily - harm to individuals, including use of Llama 3.2 related to the following:\\n - \ 8. Military, warfare, nuclear industries or applications, espionage, use - for materials or activities that are subject to the International Traffic Arms - Regulations (ITAR) maintained by the United States Department of State or to - the U.S. Biological Weapons Anti-Terrorism Act of 1989 or the Chemical Weapons - Convention Implementation Act of 1997\\n 9. Guns and illegal weapons (including - weapon development)\\n 10. Illegal drugs and regulated/controlled substances\\n - \ 11. Operation of critical infrastructure, transportation technologies, or - heavy machinery\\n 12. Self-harm or harm to others, including suicide, cutting, - and eating disorders\\n 13. Any content intended to incite or promote violence, - abuse, or any infliction of bodily harm to an individual\\n3. Intentionally - deceive or mislead others, including use of Llama 3.2 related to the following:\\n - \ 14. Generating, promoting, or furthering fraud or the creation or promotion - of disinformation\\n 15. Generating, promoting, or furthering defamatory - content, including the creation of defamatory statements, images, or other content\\n - \ 16. Generating, promoting, or further distributing spam\\n 17. Impersonating - another individual without consent, authorization, or legal right\\n 18. - Representing that the use of Llama 3.2 or outputs are human-generated\\n 19. - Generating or facilitating false online engagement, including fake reviews and - other means of fake online engagement\\n4. Fail to appropriately disclose to - end users any known dangers of your AI system\\n5. Interact with third party - tools, models, or software designed to generate unlawful content or engage in - unlawful or harmful conduct and/or represent that the outputs of such tools, - models, or software are associated with Meta or Llama 3.2\\n\\nWith respect - to any multimodal models included in Llama 3.2, the rights granted under Section - 1(a) of the Llama 3.2 Community License Agreement are not being granted to you - if you are an individual domiciled in, or a company with a principal place of - business in, the European Union. This restriction does not apply to end users - of a product or service that incorporates any such multimodal models.\\n\\nPlease - report any violation of this Policy, software \u201Cbug,\u201D or other problems - that could lead to a violation of this Policy through one of the following means:\\n\\n\\n\\n* - Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://l.workplace.com/l.php?u=https%3A%2F%2Fgithub.com%2Fmeta-llama%2Fllama-models%2Fissues\\u0026h=AT0qV8W9BFT6NwihiOHRuKYQM_UnkzN_NmHMy91OT55gkLpgi4kQupHUl0ssR4dQsIQ8n3tfd0vtkobvsEvt1l4Ic6GXI2EeuHV8N08OG2WnbAmm0FL4ObkazC6G_256vN0lN9DsykCvCqGZ)\\n* - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\\n* - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\\n* - Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama - 3.2: LlamaUseReport@meta.com\\\"\\n\",\"parameters\":\"stop \\\"\\u003c|start_header_id|\\u003e\\\"\\nstop - \ \\\"\\u003c|end_header_id|\\u003e\\\"\\nstop \\\"\\u003c|eot_id|\\u003e\\\"\",\"template\":\"\\u003c|start_header_id|\\u003esystem\\u003c|end_header_id|\\u003e\\n\\nCutting - Knowledge Date: December 2023\\n\\n{{ if .System }}{{ .System }}\\n{{- end }}\\n{{- - if .Tools }}When you receive a tool call response, use the output to format - an answer to the orginal user question.\\n\\nYou are a helpful assistant with - tool calling capabilities.\\n{{- end }}\\u003c|eot_id|\\u003e\\n{{- range $i, - $_ := .Messages }}\\n{{- $last := eq (len (slice $.Messages $i)) 1 }}\\n{{- - if eq .Role \\\"user\\\" }}\\u003c|start_header_id|\\u003euser\\u003c|end_header_id|\\u003e\\n{{- - if and $.Tools $last }}\\n\\nGiven the following functions, please respond with - a JSON for a function call with its proper arguments that best answers the given - prompt.\\n\\nRespond in the format {\\\"name\\\": function name, \\\"parameters\\\": - dictionary of argument name and its value}. Do not use variables.\\n\\n{{ range - $.Tools }}\\n{{- . }}\\n{{ end }}\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- - else }}\\n\\n{{ .Content }}\\u003c|eot_id|\\u003e\\n{{- end }}{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- else if eq .Role \\\"assistant\\\" }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n{{- - if .ToolCalls }}\\n{{ range .ToolCalls }}\\n{\\\"name\\\": \\\"{{ .Function.Name - }}\\\", \\\"parameters\\\": {{ .Function.Arguments }}}{{ end }}\\n{{- else }}\\n\\n{{ - .Content }}\\n{{- end }}{{ if not $last }}\\u003c|eot_id|\\u003e{{ end }}\\n{{- - else if eq .Role \\\"tool\\\" }}\\u003c|start_header_id|\\u003eipython\\u003c|end_header_id|\\u003e\\n\\n{{ - .Content }}\\u003c|eot_id|\\u003e{{ if $last }}\\u003c|start_header_id|\\u003eassistant\\u003c|end_header_id|\\u003e\\n\\n{{ - end }}\\n{{- end }}\\n{{- end }}\",\"details\":{\"parent_model\":\"\",\"format\":\"gguf\",\"family\":\"llama\",\"families\":[\"llama\"],\"parameter_size\":\"3.2B\",\"quantization_level\":\"Q4_K_M\"},\"model_info\":{\"general.architecture\":\"llama\",\"general.basename\":\"Llama-3.2\",\"general.file_type\":15,\"general.finetune\":\"Instruct\",\"general.languages\":[\"en\",\"de\",\"fr\",\"it\",\"pt\",\"hi\",\"es\",\"th\"],\"general.parameter_count\":3212749888,\"general.quantization_version\":2,\"general.size_label\":\"3B\",\"general.tags\":[\"facebook\",\"meta\",\"pytorch\",\"llama\",\"llama-3\",\"text-generation\"],\"general.type\":\"model\",\"llama.attention.head_count\":24,\"llama.attention.head_count_kv\":8,\"llama.attention.key_length\":128,\"llama.attention.layer_norm_rms_epsilon\":0.00001,\"llama.attention.value_length\":128,\"llama.block_count\":28,\"llama.context_length\":131072,\"llama.embedding_length\":3072,\"llama.feed_forward_length\":8192,\"llama.rope.dimension_count\":128,\"llama.rope.freq_base\":500000,\"llama.vocab_size\":128256,\"tokenizer.ggml.bos_token_id\":128000,\"tokenizer.ggml.eos_token_id\":128009,\"tokenizer.ggml.merges\":null,\"tokenizer.ggml.model\":\"gpt2\",\"tokenizer.ggml.pre\":\"llama-bpe\",\"tokenizer.ggml.token_type\":null,\"tokenizer.ggml.tokens\":null},\"modified_at\":\"2024-12-31T11:53:14.529771974-05:00\"}" - headers: - Content-Type: - - application/json; charset=utf-8 - Date: - - Tue, 31 Dec 2024 17:00:06 GMT - Transfer-Encoding: - - chunked - http_version: HTTP/1.1 - status_code: 200 + - Thu, 02 Jan 2025 20:24:24 GMT + status: + code: 200 + message: OK version: 1 diff --git a/tests/cli/tools/test_main.py b/tests/cli/tools/test_main.py index 10c29b920..b06c0b28c 100644 --- a/tests/cli/tools/test_main.py +++ b/tests/cli/tools/test_main.py @@ -28,9 +28,10 @@ def test_create_success(mock_subprocess): with in_temp_dir(): tool_command = ToolCommand() - with patch.object(tool_command, "login") as mock_login, patch( - "sys.stdout", new=StringIO() - ) as fake_out: + with ( + patch.object(tool_command, "login") as mock_login, + patch("sys.stdout", new=StringIO()) as fake_out, + ): tool_command.create("test-tool") output = fake_out.getvalue() @@ -82,7 +83,7 @@ def test_install_success(mock_get, mock_subprocess_run): capture_output=False, text=True, check=True, - env=unittest.mock.ANY + env=unittest.mock.ANY, ) assert "Successfully installed sample-tool" in output diff --git a/tests/crew_test.py b/tests/crew_test.py index 0cb8f469c..8354f6584 100644 --- a/tests/crew_test.py +++ b/tests/crew_test.py @@ -333,16 +333,16 @@ def test_manager_agent_delegating_to_assigned_task_agent(): ) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) # Because we are mocking execute_sync, we never hit the underlying _execute_core # which sets the output attribute of the task task.output = mock_task_output - with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Verify execute_sync was called once @@ -350,12 +350,20 @@ def test_manager_agent_delegating_to_assigned_task_agent(): # Get the tools argument from the call _, kwargs = mock_execute_sync.call_args - tools = kwargs['tools'] + tools = kwargs["tools"] # Verify the delegation tools were passed correctly assert len(tools) == 2 - assert any("Delegate a specific task to one of the following coworkers: Researcher" in tool.description for tool in tools) - assert any("Ask a specific question to one of the following coworkers: Researcher" in tool.description for tool in tools) + assert any( + "Delegate a specific task to one of the following coworkers: Researcher" + in tool.description + for tool in tools + ) + assert any( + "Ask a specific question to one of the following coworkers: Researcher" + in tool.description + for tool in tools + ) @pytest.mark.vcr(filter_headers=["authorization"]) @@ -404,7 +412,7 @@ def test_manager_agent_delegates_with_varied_role_cases(): backstory="A researcher with spaces in role name", allow_delegation=False, ) - + writer_caps = Agent( role="SENIOR WRITER", # All caps goal="Write with caps in role", @@ -426,13 +434,13 @@ def test_manager_agent_delegates_with_varied_role_cases(): ) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) task.output = mock_task_output - with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Verify execute_sync was called once @@ -440,20 +448,32 @@ def test_manager_agent_delegates_with_varied_role_cases(): # Get the tools argument from the call _, kwargs = mock_execute_sync.call_args - tools = kwargs['tools'] + tools = kwargs["tools"] # Verify the delegation tools were passed correctly and can handle case/whitespace variations assert len(tools) == 2 - + # Check delegation tool descriptions (should work despite case/whitespace differences) delegation_tool = tools[0] question_tool = tools[1] - - assert "Delegate a specific task to one of the following coworkers:" in delegation_tool.description - assert " Researcher " in delegation_tool.description or "SENIOR WRITER" in delegation_tool.description - - assert "Ask a specific question to one of the following coworkers:" in question_tool.description - assert " Researcher " in question_tool.description or "SENIOR WRITER" in question_tool.description + + assert ( + "Delegate a specific task to one of the following coworkers:" + in delegation_tool.description + ) + assert ( + " Researcher " in delegation_tool.description + or "SENIOR WRITER" in delegation_tool.description + ) + + assert ( + "Ask a specific question to one of the following coworkers:" + in question_tool.description + ) + assert ( + " Researcher " in question_tool.description + or "SENIOR WRITER" in question_tool.description + ) @pytest.mark.vcr(filter_headers=["authorization"]) @@ -479,6 +499,7 @@ def test_crew_with_delegating_agents(): == "In the rapidly evolving landscape of technology, AI agents have emerged as formidable tools, revolutionizing how we interact with data and automate tasks. These sophisticated systems leverage machine learning and natural language processing to perform a myriad of functions, from virtual personal assistants to complex decision-making companions in industries such as finance, healthcare, and education. By mimicking human intelligence, AI agents can analyze massive data sets at unparalleled speeds, enabling businesses to uncover valuable insights, enhance productivity, and elevate user experiences to unprecedented levels.\n\nOne of the most striking aspects of AI agents is their adaptability; they learn from their interactions and continuously improve their performance over time. This feature is particularly valuable in customer service where AI agents can address inquiries, resolve issues, and provide personalized recommendations without the limitations of human fatigue. Moreover, with intuitive interfaces, AI agents enhance user interactions, making technology more accessible and user-friendly, thereby breaking down barriers that have historically hindered digital engagement.\n\nDespite their immense potential, the deployment of AI agents raises important ethical and practical considerations. Issues related to privacy, data security, and the potential for job displacement necessitate thoughtful dialogue and proactive measures. Striking a balance between technological innovation and societal impact will be crucial as organizations integrate these agents into their operations. Additionally, ensuring transparency in AI decision-making processes is vital to maintain public trust as AI agents become an integral part of daily life.\n\nLooking ahead, the future of AI agents appears bright, with ongoing advancements promising even greater capabilities. As we continue to harness the power of AI, we can expect these agents to play a transformative role in shaping various sectors—streamlining workflows, enabling smarter decision-making, and fostering more personalized experiences. Embracing this technology responsibly can lead to a future where AI agents not only augment human effort but also inspire creativity and efficiency across the board, ultimately redefining our interaction with the digital world." ) + @pytest.mark.vcr(filter_headers=["authorization"]) def test_crew_with_delegating_agents_should_not_override_task_tools(): from typing import Type @@ -489,6 +510,7 @@ def test_crew_with_delegating_agents_should_not_override_task_tools(): class TestToolInput(BaseModel): """Input schema for TestTool.""" + query: str = Field(..., description="Query to process") class TestTool(BaseTool): @@ -516,24 +538,29 @@ def test_crew_with_delegating_agents_should_not_override_task_tools(): ) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) # Because we are mocking execute_sync, we never hit the underlying _execute_core # which sets the output attribute of the task tasks[0].output = mock_task_output - with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Execute the task and verify both tools are present _, kwargs = mock_execute_sync.call_args - tools = kwargs['tools'] + tools = kwargs["tools"] + + assert any( + isinstance(tool, TestTool) for tool in tools + ), "TestTool should be present" + assert any( + "delegate" in tool.name.lower() for tool in tools + ), "Delegation tool should be present" - assert any(isinstance(tool, TestTool) for tool in tools), "TestTool should be present" - assert any("delegate" in tool.name.lower() for tool in tools), "Delegation tool should be present" @pytest.mark.vcr(filter_headers=["authorization"]) def test_crew_with_delegating_agents_should_not_override_agent_tools(): @@ -545,6 +572,7 @@ def test_crew_with_delegating_agents_should_not_override_agent_tools(): class TestToolInput(BaseModel): """Input schema for TestTool.""" + query: str = Field(..., description="Query to process") class TestTool(BaseTool): @@ -563,7 +591,7 @@ def test_crew_with_delegating_agents_should_not_override_agent_tools(): Task( description="Produce and amazing 1 paragraph draft of an article about AI Agents.", expected_output="A 4 paragraph article about AI.", - agent=new_ceo + agent=new_ceo, ) ] @@ -574,24 +602,29 @@ def test_crew_with_delegating_agents_should_not_override_agent_tools(): ) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) # Because we are mocking execute_sync, we never hit the underlying _execute_core # which sets the output attribute of the task tasks[0].output = mock_task_output - with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Execute the task and verify both tools are present _, kwargs = mock_execute_sync.call_args - tools = kwargs['tools'] + tools = kwargs["tools"] + + assert any( + isinstance(tool, TestTool) for tool in new_ceo.tools + ), "TestTool should be present" + assert any( + "delegate" in tool.name.lower() for tool in tools + ), "Delegation tool should be present" - assert any(isinstance(tool, TestTool) for tool in new_ceo.tools), "TestTool should be present" - assert any("delegate" in tool.name.lower() for tool in tools), "Delegation tool should be present" @pytest.mark.vcr(filter_headers=["authorization"]) def test_task_tools_override_agent_tools(): @@ -603,6 +636,7 @@ def test_task_tools_override_agent_tools(): class TestToolInput(BaseModel): """Input schema for TestTool.""" + query: str = Field(..., description="Query to process") class TestTool(BaseTool): @@ -630,14 +664,10 @@ def test_task_tools_override_agent_tools(): description="Write a test task", expected_output="Test output", agent=new_researcher, - tools=[AnotherTestTool()] + tools=[AnotherTestTool()], ) - crew = Crew( - agents=[new_researcher], - tasks=[task], - process=Process.sequential - ) + crew = Crew(agents=[new_researcher], tasks=[task], process=Process.sequential) crew.kickoff() @@ -650,6 +680,7 @@ def test_task_tools_override_agent_tools(): assert len(new_researcher.tools) == 1 assert isinstance(new_researcher.tools[0], TestTool) + @pytest.mark.vcr(filter_headers=["authorization"]) def test_task_tools_override_agent_tools_with_allow_delegation(): """ @@ -702,13 +733,13 @@ def test_task_tools_override_agent_tools_with_allow_delegation(): ) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) # We mock execute_sync to verify which tools get used at runtime - with patch.object(Task, "execute_sync", return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Inspect the call kwargs to verify the actual tools passed to execution @@ -716,16 +747,23 @@ def test_task_tools_override_agent_tools_with_allow_delegation(): used_tools = kwargs["tools"] # Confirm AnotherTestTool is present but TestTool is not - assert any(isinstance(tool, AnotherTestTool) for tool in used_tools), "AnotherTestTool should be present" - assert not any(isinstance(tool, TestTool) for tool in used_tools), "TestTool should not be present among used tools" + assert any( + isinstance(tool, AnotherTestTool) for tool in used_tools + ), "AnotherTestTool should be present" + assert not any( + isinstance(tool, TestTool) for tool in used_tools + ), "TestTool should not be present among used tools" # Confirm delegation tool(s) are present - assert any("delegate" in tool.name.lower() for tool in used_tools), "Delegation tool should be present" + assert any( + "delegate" in tool.name.lower() for tool in used_tools + ), "Delegation tool should be present" # Finally, make sure the agent's original tools remain unchanged assert len(researcher_with_delegation.tools) == 1 assert isinstance(researcher_with_delegation.tools[0], TestTool) + @pytest.mark.vcr(filter_headers=["authorization"]) def test_crew_verbose_output(capsys): tasks = [ @@ -1012,8 +1050,8 @@ def test_three_task_with_async_execution(): ) -@pytest.mark.vcr(filter_headers=["authorization"]) @pytest.mark.asyncio +@pytest.mark.vcr(filter_headers=["authorization"]) async def test_crew_async_kickoff(): inputs = [ {"topic": "dog"}, @@ -1060,8 +1098,9 @@ async def test_crew_async_kickoff(): assert result[0].token_usage.successful_requests > 0 # type: ignore +@pytest.mark.asyncio @pytest.mark.vcr(filter_headers=["authorization"]) -def test_async_task_execution_call_count(): +async def test_async_task_execution_call_count(): from unittest.mock import MagicMock, patch list_ideas = Task( @@ -1188,7 +1227,6 @@ def test_kickoff_for_each_empty_input(): assert results == [] -@pytest.mark.vcr(filter_headers=["authorization"]) def test_kickoff_for_each_invalid_input(): """Tests if kickoff_for_each raises TypeError for invalid input types.""" @@ -1211,7 +1249,6 @@ def test_kickoff_for_each_invalid_input(): crew.kickoff_for_each("invalid input") -@pytest.mark.vcr(filter_headers=["authorization"]) def test_kickoff_for_each_error_handling(): """Tests error handling in kickoff_for_each when kickoff raises an error.""" from unittest.mock import patch @@ -1248,7 +1285,6 @@ def test_kickoff_for_each_error_handling(): crew.kickoff_for_each(inputs=inputs) -@pytest.mark.vcr(filter_headers=["authorization"]) @pytest.mark.asyncio async def test_kickoff_async_basic_functionality_and_output(): """Tests the basic functionality and output of kickoff_async.""" @@ -1283,7 +1319,6 @@ async def test_kickoff_async_basic_functionality_and_output(): mock_kickoff.assert_called_once_with(inputs) -@pytest.mark.vcr(filter_headers=["authorization"]) @pytest.mark.asyncio async def test_async_kickoff_for_each_async_basic_functionality_and_output(): """Tests the basic functionality and output of kickoff_for_each_async.""" @@ -1330,7 +1365,6 @@ async def test_async_kickoff_for_each_async_basic_functionality_and_output(): mock_kickoff_async.assert_any_call(inputs=input_data) -@pytest.mark.vcr(filter_headers=["authorization"]) @pytest.mark.asyncio async def test_async_kickoff_for_each_async_empty_input(): """Tests if akickoff_for_each_async handles an empty input list.""" @@ -1514,12 +1548,12 @@ def test_code_execution_flag_adds_code_tool_upon_kickoff(): crew = Crew(agents=[programmer], tasks=[task]) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) - with patch.object(Task, "execute_sync", return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Get the tools that were actually used in execution @@ -1528,7 +1562,10 @@ def test_code_execution_flag_adds_code_tool_upon_kickoff(): # Verify that exactly one tool was used and it was a CodeInterpreterTool assert len(used_tools) == 1, "Should have exactly one tool" - assert isinstance(used_tools[0], CodeInterpreterTool), "Tool should be CodeInterpreterTool" + assert isinstance( + used_tools[0], CodeInterpreterTool + ), "Tool should be CodeInterpreterTool" + @pytest.mark.vcr(filter_headers=["authorization"]) def test_delegation_is_not_enabled_if_there_are_only_one_agent(): @@ -1639,16 +1676,16 @@ def test_hierarchical_crew_creation_tasks_with_agents(): ) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) # Because we are mocking execute_sync, we never hit the underlying _execute_core # which sets the output attribute of the task task.output = mock_task_output - with patch.object(Task, 'execute_sync', return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Verify execute_sync was called once @@ -1656,12 +1693,20 @@ def test_hierarchical_crew_creation_tasks_with_agents(): # Get the tools argument from the call _, kwargs = mock_execute_sync.call_args - tools = kwargs['tools'] + tools = kwargs["tools"] # Verify the delegation tools were passed correctly assert len(tools) == 2 - assert any("Delegate a specific task to one of the following coworkers: Senior Writer" in tool.description for tool in tools) - assert any("Ask a specific question to one of the following coworkers: Senior Writer" in tool.description for tool in tools) + assert any( + "Delegate a specific task to one of the following coworkers: Senior Writer" + in tool.description + for tool in tools + ) + assert any( + "Ask a specific question to one of the following coworkers: Senior Writer" + in tool.description + for tool in tools + ) @pytest.mark.vcr(filter_headers=["authorization"]) @@ -1684,9 +1729,7 @@ def test_hierarchical_crew_creation_tasks_with_async_execution(): ) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) # Create a mock Future that returns our TaskOutput @@ -1697,7 +1740,9 @@ def test_hierarchical_crew_creation_tasks_with_async_execution(): # which sets the output attribute of the task task.output = mock_task_output - with patch.object(Task, 'execute_async', return_value=mock_future) as mock_execute_async: + with patch.object( + Task, "execute_async", return_value=mock_future + ) as mock_execute_async: crew.kickoff() # Verify execute_async was called once @@ -1705,12 +1750,20 @@ def test_hierarchical_crew_creation_tasks_with_async_execution(): # Get the tools argument from the call _, kwargs = mock_execute_async.call_args - tools = kwargs['tools'] + tools = kwargs["tools"] # Verify the delegation tools were passed correctly assert len(tools) == 2 - assert any("Delegate a specific task to one of the following coworkers: Senior Writer\n" in tool.description for tool in tools) - assert any("Ask a specific question to one of the following coworkers: Senior Writer\n" in tool.description for tool in tools) + assert any( + "Delegate a specific task to one of the following coworkers: Senior Writer\n" + in tool.description + for tool in tools + ) + assert any( + "Ask a specific question to one of the following coworkers: Senior Writer\n" + in tool.description + for tool in tools + ) @pytest.mark.vcr(filter_headers=["authorization"]) @@ -2039,7 +2092,6 @@ def test_crew_output_file_end_to_end(tmp_path): assert expected_file.exists(), f"Output file {expected_file} was not created" -@pytest.mark.vcr(filter_headers=["authorization"]) def test_crew_output_file_validation_failures(): """Test output file validation failures in a crew context.""" agent = Agent( @@ -2055,7 +2107,7 @@ def test_crew_output_file_validation_failures(): description="Analyze data", expected_output="Analysis results", agent=agent, - output_file="../output.txt" + output_file="../output.txt", ) Crew(agents=[agent], tasks=[task]).kickoff() @@ -2065,7 +2117,7 @@ def test_crew_output_file_validation_failures(): description="Analyze data", expected_output="Analysis results", agent=agent, - output_file="output.txt | rm -rf /" + output_file="output.txt | rm -rf /", ) Crew(agents=[agent], tasks=[task]).kickoff() @@ -2075,7 +2127,7 @@ def test_crew_output_file_validation_failures(): description="Analyze data", expected_output="Analysis results", agent=agent, - output_file="~/output.txt" + output_file="~/output.txt", ) Crew(agents=[agent], tasks=[task]).kickoff() @@ -2085,12 +2137,11 @@ def test_crew_output_file_validation_failures(): description="Analyze data", expected_output="Analysis results", agent=agent, - output_file="{invalid-name}/output.txt" + output_file="{invalid-name}/output.txt", ) Crew(agents=[agent], tasks=[task]).kickoff() -@pytest.mark.vcr(filter_headers=["authorization"]) def test_manager_agent(): from unittest.mock import patch @@ -3049,6 +3100,7 @@ def test_task_tools_preserve_code_execution_tools(): class TestToolInput(BaseModel): """Input schema for TestTool.""" + query: str = Field(..., description="Query to process") class TestTool(BaseTool): @@ -3082,7 +3134,7 @@ def test_task_tools_preserve_code_execution_tools(): description="Write a program to calculate fibonacci numbers.", expected_output="A working fibonacci calculator.", agent=programmer, - tools=[TestTool()] + tools=[TestTool()], ) crew = Crew( @@ -3092,12 +3144,12 @@ def test_task_tools_preserve_code_execution_tools(): ) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) - with patch.object(Task, "execute_sync", return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Get the tools that were actually used in execution @@ -3105,12 +3157,21 @@ def test_task_tools_preserve_code_execution_tools(): used_tools = kwargs["tools"] # Verify all expected tools are present - assert any(isinstance(tool, TestTool) for tool in used_tools), "Task's TestTool should be present" - assert any(isinstance(tool, CodeInterpreterTool) for tool in used_tools), "CodeInterpreterTool should be present" - assert any("delegate" in tool.name.lower() for tool in used_tools), "Delegation tool should be present" + assert any( + isinstance(tool, TestTool) for tool in used_tools + ), "Task's TestTool should be present" + assert any( + isinstance(tool, CodeInterpreterTool) for tool in used_tools + ), "CodeInterpreterTool should be present" + assert any( + "delegate" in tool.name.lower() for tool in used_tools + ), "Delegation tool should be present" # Verify the total number of tools (TestTool + CodeInterpreter + 2 delegation tools) - assert len(used_tools) == 4, "Should have TestTool, CodeInterpreter, and 2 delegation tools" + assert ( + len(used_tools) == 4 + ), "Should have TestTool, CodeInterpreter, and 2 delegation tools" + @pytest.mark.vcr(filter_headers=["authorization"]) def test_multimodal_flag_adds_multimodal_tools(): @@ -3139,13 +3200,13 @@ def test_multimodal_flag_adds_multimodal_tools(): crew = Crew(agents=[multimodal_agent], tasks=[task], process=Process.sequential) mock_task_output = TaskOutput( - description="Mock description", - raw="mocked output", - agent="mocked agent" + description="Mock description", raw="mocked output", agent="mocked agent" ) # Mock execute_sync to verify the tools passed at runtime - with patch.object(Task, "execute_sync", return_value=mock_task_output) as mock_execute_sync: + with patch.object( + Task, "execute_sync", return_value=mock_task_output + ) as mock_execute_sync: crew.kickoff() # Get the tools that were actually used in execution @@ -3153,13 +3214,14 @@ def test_multimodal_flag_adds_multimodal_tools(): used_tools = kwargs["tools"] # Check that the multimodal tool was added - assert any(isinstance(tool, AddImageTool) for tool in used_tools), ( - "AddImageTool should be present when agent is multimodal" - ) + assert any( + isinstance(tool, AddImageTool) for tool in used_tools + ), "AddImageTool should be present when agent is multimodal" # Verify we have exactly one tool (just the AddImageTool) assert len(used_tools) == 1, "Should only have the AddImageTool" + @pytest.mark.vcr(filter_headers=["authorization"]) def test_multimodal_agent_image_tool_handling(): """ @@ -3201,10 +3263,10 @@ def test_multimodal_agent_image_tool_handling(): mock_task_output = TaskOutput( description="Mock description", raw="A detailed analysis of the image", - agent="Image Analyst" + agent="Image Analyst", ) - with patch.object(Task, 'execute_sync') as mock_execute_sync: + with patch.object(Task, "execute_sync") as mock_execute_sync: # Set up the mock to return our task output mock_execute_sync.return_value = mock_task_output @@ -3213,7 +3275,7 @@ def test_multimodal_agent_image_tool_handling(): # Get the tools that were passed to execute_sync _, kwargs = mock_execute_sync.call_args - tools = kwargs['tools'] + tools = kwargs["tools"] # Verify the AddImageTool is present and properly configured image_tools = [tool for tool in tools if tool.name == "Add image to content"] @@ -3223,7 +3285,7 @@ def test_multimodal_agent_image_tool_handling(): image_tool = image_tools[0] result = image_tool._run( image_url="https://example.com/test-image.jpg", - action="Please analyze this image" + action="Please analyze this image", ) # Verify the tool returns the expected format @@ -3233,6 +3295,7 @@ def test_multimodal_agent_image_tool_handling(): assert result["content"][0]["type"] == "text" assert result["content"][1]["type"] == "image_url" + @pytest.mark.vcr(filter_headers=["authorization"]) def test_multimodal_agent_live_image_analysis(): """ @@ -3246,7 +3309,7 @@ def test_multimodal_agent_live_image_analysis(): allow_delegation=False, multimodal=True, verbose=True, - llm="gpt-4o" + llm="gpt-4o", ) # Create a task for image analysis @@ -3257,19 +3320,18 @@ def test_multimodal_agent_live_image_analysis(): Image: {image_url} """, expected_output="A comprehensive description of the image contents.", - agent=image_analyst + agent=image_analyst, ) # Create and run the crew - crew = Crew( - agents=[image_analyst], - tasks=[analyze_image] - ) + crew = Crew(agents=[image_analyst], tasks=[analyze_image]) # Execute with an image URL - result = crew.kickoff(inputs={ - "image_url": "https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k=" - }) + result = crew.kickoff( + inputs={ + "image_url": "https://media.istockphoto.com/id/946087016/photo/aerial-view-of-lower-manhattan-new-york.jpg?s=612x612&w=0&k=20&c=viLiMRznQ8v5LzKTt_LvtfPFUVl1oiyiemVdSlm29_k=" + } + ) # Verify we got a meaningful response assert isinstance(result.raw, str) diff --git a/tests/knowledge/knowledge_test.py b/tests/knowledge/knowledge_test.py index 6704d3031..fad2d2513 100644 --- a/tests/knowledge/knowledge_test.py +++ b/tests/knowledge/knowledge_test.py @@ -578,14 +578,6 @@ def test_multiple_docling_sources(): assert docling_source.content is not None -def test_docling_source_with_local_file(): - current_dir = Path(__file__).parent - pdf_path = current_dir / "crewai_quickstart.pdf" - docling_source = CrewDoclingSource(file_paths=[pdf_path]) - assert docling_source.file_paths == [pdf_path] - assert docling_source.content is not None - - def test_file_path_validation(): """Test file path validation for knowledge sources.""" current_dir = Path(__file__).parent @@ -606,6 +598,6 @@ def test_file_path_validation(): # Test neither file_path nor file_paths provided with pytest.raises( ValueError, - match="file_path/file_paths must be a Path, str, or a list of these types" + match="file_path/file_paths must be a Path, str, or a list of these types", ): PDFKnowledgeSource() diff --git a/tests/task_test.py b/tests/task_test.py index dc15c251f..0fcb499b2 100644 --- a/tests/task_test.py +++ b/tests/task_test.py @@ -719,7 +719,7 @@ def test_interpolate_inputs(): task = Task( description="Give me a list of 5 interesting ideas about {topic} to explore for an article, what makes them unique and interesting.", expected_output="Bullet point list of 5 interesting ideas about {topic}.", - output_file="/tmp/{topic}/output_{date}.txt" + output_file="/tmp/{topic}/output_{date}.txt", ) task.interpolate_inputs(inputs={"topic": "AI", "date": "2024"}) @@ -742,41 +742,35 @@ def test_interpolate_inputs(): def test_interpolate_only(): """Test the interpolate_only method for various scenarios including JSON structure preservation.""" task = Task( - description="Unused in this test", - expected_output="Unused in this test" + description="Unused in this test", expected_output="Unused in this test" ) - + # Test JSON structure preservation json_string = '{"info": "Look at {placeholder}", "nested": {"val": "{nestedVal}"}}' result = task.interpolate_only( input_string=json_string, - inputs={"placeholder": "the data", "nestedVal": "something else"} + inputs={"placeholder": "the data", "nestedVal": "something else"}, ) assert '"info": "Look at the data"' in result assert '"val": "something else"' in result assert "{placeholder}" not in result assert "{nestedVal}" not in result - + # Test normal string interpolation normal_string = "Hello {name}, welcome to {place}!" result = task.interpolate_only( - input_string=normal_string, - inputs={"name": "John", "place": "CrewAI"} + input_string=normal_string, inputs={"name": "John", "place": "CrewAI"} ) assert result == "Hello John, welcome to CrewAI!" - + # Test empty string - result = task.interpolate_only( - input_string="", - inputs={"unused": "value"} - ) + result = task.interpolate_only(input_string="", inputs={"unused": "value"}) assert result == "" - + # Test string with no placeholders no_placeholders = "Hello, this is a test" result = task.interpolate_only( - input_string=no_placeholders, - inputs={"unused": "value"} + input_string=no_placeholders, inputs={"unused": "value"} ) assert result == no_placeholders @@ -880,56 +874,65 @@ def test_key(): def test_output_file_validation(): """Test output file path validation.""" # Valid paths - assert Task( - description="Test task", - expected_output="Test output", - output_file="output.txt" - ).output_file == "output.txt" - assert Task( - description="Test task", - expected_output="Test output", - output_file="/tmp/output.txt" - ).output_file == "tmp/output.txt" - assert Task( - description="Test task", - expected_output="Test output", - output_file="{dir}/output_{date}.txt" - ).output_file == "{dir}/output_{date}.txt" - + assert ( + Task( + description="Test task", + expected_output="Test output", + output_file="output.txt", + ).output_file + == "output.txt" + ) + assert ( + Task( + description="Test task", + expected_output="Test output", + output_file="/tmp/output.txt", + ).output_file + == "tmp/output.txt" + ) + assert ( + Task( + description="Test task", + expected_output="Test output", + output_file="{dir}/output_{date}.txt", + ).output_file + == "{dir}/output_{date}.txt" + ) + # Invalid paths with pytest.raises(ValueError, match="Path traversal"): Task( description="Test task", expected_output="Test output", - output_file="../output.txt" + output_file="../output.txt", ) with pytest.raises(ValueError, match="Path traversal"): Task( description="Test task", expected_output="Test output", - output_file="folder/../output.txt" + output_file="folder/../output.txt", ) with pytest.raises(ValueError, match="Shell special characters"): Task( description="Test task", expected_output="Test output", - output_file="output.txt | rm -rf /" + output_file="output.txt | rm -rf /", ) with pytest.raises(ValueError, match="Shell expansion"): Task( description="Test task", expected_output="Test output", - output_file="~/output.txt" + output_file="~/output.txt", ) with pytest.raises(ValueError, match="Shell expansion"): Task( description="Test task", expected_output="Test output", - output_file="$HOME/output.txt" + output_file="$HOME/output.txt", ) with pytest.raises(ValueError, match="Invalid template variable"): Task( description="Test task", expected_output="Test output", - output_file="{invalid-name}/output.txt" + output_file="{invalid-name}/output.txt", ) diff --git a/tests/test_manager_llm_delegation.py b/tests/test_manager_llm_delegation.py index d1f2068e4..6f8671255 100644 --- a/tests/test_manager_llm_delegation.py +++ b/tests/test_manager_llm_delegation.py @@ -8,48 +8,49 @@ from crewai.tools.agent_tools.base_agent_tools import BaseAgentTool class TestAgentTool(BaseAgentTool): """Concrete implementation of BaseAgentTool for testing.""" + def _run(self, *args, **kwargs): """Implement required _run method.""" return "Test response" -@pytest.mark.parametrize("role_name,should_match", [ - ('Futel Official Infopoint', True), # exact match - (' "Futel Official Infopoint" ', True), # extra quotes and spaces - ('Futel Official Infopoint\n', True), # trailing newline - ('"Futel Official Infopoint"', True), # embedded quotes - (' FUTEL\nOFFICIAL INFOPOINT ', True), # multiple whitespace and newline - ('futel official infopoint', True), # lowercase - ('FUTEL OFFICIAL INFOPOINT', True), # uppercase - ('Non Existent Agent', False), # non-existent agent - (None, False), # None agent name -]) + +@pytest.mark.parametrize( + "role_name,should_match", + [ + ("Futel Official Infopoint", True), # exact match + (' "Futel Official Infopoint" ', True), # extra quotes and spaces + ("Futel Official Infopoint\n", True), # trailing newline + ('"Futel Official Infopoint"', True), # embedded quotes + (" FUTEL\nOFFICIAL INFOPOINT ", True), # multiple whitespace and newline + ("futel official infopoint", True), # lowercase + ("FUTEL OFFICIAL INFOPOINT", True), # uppercase + ("Non Existent Agent", False), # non-existent agent + (None, False), # None agent name + ], +) def test_agent_tool_role_matching(role_name, should_match): """Test that agent tools can match roles regardless of case, whitespace, and special characters.""" # Create test agent test_agent = Agent( - role='Futel Official Infopoint', - goal='Answer questions about Futel', - backstory='Futel Football Club info', - allow_delegation=False + role="Futel Official Infopoint", + goal="Answer questions about Futel", + backstory="Futel Football Club info", + allow_delegation=False, ) # Create test agent tool agent_tool = TestAgentTool( - name="test_tool", - description="Test tool", - agents=[test_agent] + name="test_tool", description="Test tool", agents=[test_agent] ) # Test role matching - result = agent_tool._execute( - agent_name=role_name, - task='Test task', - context=None - ) + result = agent_tool._execute(agent_name=role_name, task="Test task", context=None) if should_match: - assert "coworker mentioned not found" not in result.lower(), \ - f"Should find agent with role name: {role_name}" + assert ( + "coworker mentioned not found" not in result.lower() + ), f"Should find agent with role name: {role_name}" else: - assert "coworker mentioned not found" in result.lower(), \ - f"Should not find agent with role name: {role_name}" + assert ( + "coworker mentioned not found" in result.lower() + ), f"Should not find agent with role name: {role_name}" diff --git a/tests/test_task_guardrails.py b/tests/test_task_guardrails.py index dc96cb878..e22e76234 100644 --- a/tests/test_task_guardrails.py +++ b/tests/test_task_guardrails.py @@ -15,10 +15,7 @@ def test_task_without_guardrail(): agent.execute_task.return_value = "test result" agent.crew = None - task = Task( - description="Test task", - expected_output="Output" - ) + task = Task(description="Test task", expected_output="Output") result = task.execute_sync(agent=agent) assert isinstance(result, TaskOutput) @@ -27,6 +24,7 @@ def test_task_without_guardrail(): def test_task_with_successful_guardrail(): """Test that successful guardrail validation passes transformed result.""" + def guardrail(result: TaskOutput): return (True, result.raw.upper()) @@ -35,11 +33,7 @@ def test_task_with_successful_guardrail(): agent.execute_task.return_value = "test result" agent.crew = None - task = Task( - description="Test task", - expected_output="Output", - guardrail=guardrail - ) + task = Task(description="Test task", expected_output="Output", guardrail=guardrail) result = task.execute_sync(agent=agent) assert isinstance(result, TaskOutput) @@ -48,22 +42,20 @@ def test_task_with_successful_guardrail(): def test_task_with_failing_guardrail(): """Test that failing guardrail triggers retry with error context.""" + def guardrail(result: TaskOutput): return (False, "Invalid format") agent = Mock() agent.role = "test_agent" - agent.execute_task.side_effect = [ - "bad result", - "good result" - ] + agent.execute_task.side_effect = ["bad result", "good result"] agent.crew = None task = Task( description="Test task", expected_output="Output", guardrail=guardrail, - max_retries=1 + max_retries=1, ) # First execution fails guardrail, second succeeds @@ -77,6 +69,7 @@ def test_task_with_failing_guardrail(): def test_task_with_guardrail_retries(): """Test that guardrail respects max_retries configuration.""" + def guardrail(result: TaskOutput): return (False, "Invalid format") @@ -89,7 +82,7 @@ def test_task_with_guardrail_retries(): description="Test task", expected_output="Output", guardrail=guardrail, - max_retries=2 + max_retries=2, ) with pytest.raises(Exception) as exc_info: @@ -102,6 +95,7 @@ def test_task_with_guardrail_retries(): def test_guardrail_error_in_context(): """Test that guardrail error is passed in context for retry.""" + def guardrail(result: TaskOutput): return (False, "Expected JSON, got string") @@ -113,11 +107,12 @@ def test_guardrail_error_in_context(): description="Test task", expected_output="Output", guardrail=guardrail, - max_retries=1 + max_retries=1, ) # Mock execute_task to succeed on second attempt first_call = True + def execute_task(task, context, tools): nonlocal first_call if first_call: diff --git a/uv.lock b/uv.lock index dad7b150e..0e3e63276 100644 --- a/uv.lock +++ b/uv.lock @@ -1,18 +1,18 @@ version = 1 requires-python = ">=3.10, <3.13" resolution-markers = [ - "python_full_version < '3.11' and platform_system == 'Darwin'", - "python_full_version < '3.11' and platform_machine == 'aarch64' and platform_system == 'Linux'", - "(python_full_version < '3.11' and platform_machine != 'aarch64' and platform_system != 'Darwin') or (python_full_version < '3.11' and platform_system != 'Darwin' and platform_system != 'Linux')", - "python_full_version == '3.11.*' and platform_system == 'Darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and platform_system == 'Linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and platform_system != 'Darwin') or (python_full_version == '3.11.*' and platform_system != 'Darwin' and platform_system != 'Linux')", - "python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_system == 'Darwin'", - "python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_machine == 'aarch64' and platform_system == 'Linux'", - "(python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_machine != 'aarch64' and platform_system != 'Darwin') or (python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_system != 'Darwin' and platform_system != 'Linux')", - "python_full_version >= '3.12.4' and platform_system == 'Darwin'", - "python_full_version >= '3.12.4' and platform_machine == 'aarch64' and platform_system == 'Linux'", - "(python_full_version >= '3.12.4' and platform_machine != 'aarch64' and platform_system != 'Darwin') or (python_full_version >= '3.12.4' and platform_system != 'Darwin' and platform_system != 'Linux')", + "python_full_version < '3.11' and sys_platform == 'darwin'", + "python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version == '3.11.*' and sys_platform == 'darwin'", + "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version >= '3.12' and python_full_version < '3.12.4' and sys_platform == 'darwin'", + "python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version >= '3.12' and python_full_version < '3.12.4' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and python_full_version < '3.12.4' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version >= '3.12.4' and sys_platform == 'darwin'", + "python_full_version >= '3.12.4' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version >= '3.12.4' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12.4' and sys_platform != 'darwin' and sys_platform != 'linux')", ] [[package]] @@ -683,7 +683,7 @@ requires-dist = [ { name = "instructor", specifier = ">=1.3.3" }, { name = "json-repair", specifier = ">=0.25.2" }, { name = "jsonref", specifier = ">=1.1.0" }, - { name = "litellm", specifier = ">=1.56.4" }, + { name = "litellm", specifier = ">=1.44.22" }, { name = "mem0ai", marker = "extra == 'mem0'", specifier = ">=0.1.29" }, { name = "openai", specifier = ">=1.13.3" }, { name = "openpyxl", specifier = ">=3.1.5" }, @@ -2229,24 +2229,24 @@ wheels = [ [[package]] name = "litellm" -version = "1.56.4" +version = "1.50.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "aiohttp" }, { name = "click" }, - { name = "httpx" }, { name = "importlib-metadata" }, { name = "jinja2" }, { name = "jsonschema" }, { name = "openai" }, { name = "pydantic" }, { name = "python-dotenv" }, + { name = "requests" }, { name = "tiktoken" }, { name = "tokenizers" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/83/ea/2c51d16c244a64dd3f0bdb1757aef798cf943b92e5695da04e3e42ba09e0/litellm-1.56.4.tar.gz", hash = "sha256:2808ca21878d200f7676a3d11e5bf2b5e3349ae504628f279cd7297c7dbd2038", size = 6284983 } +sdist = { url = "https://files.pythonhosted.org/packages/a7/45/4d54617b267a96f1f7c17c0010ea1aba20e30a3672b873fe92a6001e5952/litellm-1.50.2.tar.gz", hash = "sha256:b244c9a0e069cc626b85fb9f5cc252114aaff1225500da30ce0940f841aef8ea", size = 6096949 } wheels = [ - { url = "https://files.pythonhosted.org/packages/8f/25/2fd7b28a270b2963e8fa0ecf6aab4db47c54d932cc5aac8bc87e7ebc3755/litellm-1.56.4-py3-none-any.whl", hash = "sha256:699a8db46f7de045069a77c435e13244b5fdaf5df1c8cb5e6ad675ef7e104ccd", size = 6564370 }, + { url = "https://files.pythonhosted.org/packages/22/f3/89a4d65d1b9286eb5ac6a6e92dd93523d92f3142a832e60c00d5cad64176/litellm-1.50.2-py3-none-any.whl", hash = "sha256:99cac60c78037946ab809b7cfbbadad53507bb2db8ae39391b4be215a0869fdd", size = 6318265 }, ] [[package]] @@ -2900,7 +2900,7 @@ name = "nvidia-cudnn-cu12" version = "9.1.0.70" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "nvidia-cublas-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux')" }, + { name = "nvidia-cublas-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux' and sys_platform != 'linux')" }, ] wheels = [ { url = "https://files.pythonhosted.org/packages/9f/fd/713452cd72343f682b1c7b9321e23829f00b842ceaedcda96e742ea0b0b3/nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl", hash = "sha256:165764f44ef8c61fcdfdfdbe769d687e06374059fbb388b6c89ecb0e28793a6f", size = 664752741 }, @@ -2927,9 +2927,9 @@ name = "nvidia-cusolver-cu12" version = "11.4.5.107" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "nvidia-cublas-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux')" }, - { name = "nvidia-cusparse-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux')" }, - { name = "nvidia-nvjitlink-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux')" }, + { name = "nvidia-cublas-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux' and sys_platform != 'linux')" }, + { name = "nvidia-cusparse-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux' and sys_platform != 'linux')" }, + { name = "nvidia-nvjitlink-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux' and sys_platform != 'linux')" }, ] wheels = [ { url = "https://files.pythonhosted.org/packages/bc/1d/8de1e5c67099015c834315e333911273a8c6aaba78923dd1d1e25fc5f217/nvidia_cusolver_cu12-11.4.5.107-py3-none-manylinux1_x86_64.whl", hash = "sha256:8a7ec542f0412294b15072fa7dab71d31334014a69f953004ea7a118206fe0dd", size = 124161928 }, @@ -2940,7 +2940,7 @@ name = "nvidia-cusparse-cu12" version = "12.1.0.106" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "nvidia-nvjitlink-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux')" }, + { name = "nvidia-nvjitlink-cu12", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux' and sys_platform != 'linux')" }, ] wheels = [ { url = "https://files.pythonhosted.org/packages/65/5b/cfaeebf25cd9fdec14338ccb16f6b2c4c7fa9163aefcf057d86b9cc248bb/nvidia_cusparse_cu12-12.1.0.106-py3-none-manylinux1_x86_64.whl", hash = "sha256:f3b50f42cf363f86ab21f720998517a659a48131e8d538dc02f8768237bd884c", size = 195958278 }, @@ -3040,7 +3040,7 @@ wheels = [ [[package]] name = "openai" -version = "1.58.1" +version = "1.52.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, @@ -3052,9 +3052,9 @@ dependencies = [ { name = "tqdm" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/27/3c/b1ecce430ed56fa3ac1b0676966d3250aab9c70a408232b71e419ea62148/openai-1.58.1.tar.gz", hash = "sha256:f5a035fd01e141fc743f4b0e02c41ca49be8fab0866d3b67f5f29b4f4d3c0973", size = 343411 } +sdist = { url = "https://files.pythonhosted.org/packages/80/ac/54c76352d493866637756b7c0ecec44f0b5bafb8fe753d98472cf6cfe4ce/openai-1.52.1.tar.gz", hash = "sha256:383b96c7e937cbec23cad5bf5718085381e4313ca33c5c5896b54f8e1b19d144", size = 310069 } wheels = [ - { url = "https://files.pythonhosted.org/packages/8e/5a/d22cd07f1a99b9e8b3c92ee0c1959188db4318828a3d88c9daac120bdd69/openai-1.58.1-py3-none-any.whl", hash = "sha256:e2910b1170a6b7f88ef491ac3a42c387f08bd3db533411f7ee391d166571d63c", size = 454279 }, + { url = "https://files.pythonhosted.org/packages/ad/31/28a83e124e9f9dd04c83b5aeb6f8b1770f45addde4dd3d34d9a9091590ad/openai-1.52.1-py3-none-any.whl", hash = "sha256:f23e83df5ba04ee0e82c8562571e8cb596cd88f9a84ab783e6c6259e5ffbfb4a", size = 386945 }, ] [[package]] @@ -5165,7 +5165,7 @@ name = "triton" version = "3.0.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "filelock", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux')" }, + { name = "filelock", marker = "(platform_machine != 'aarch64' and platform_system != 'Darwin') or (platform_system != 'Darwin' and platform_system != 'Linux' and sys_platform != 'linux')" }, ] wheels = [ { url = "https://files.pythonhosted.org/packages/45/27/14cc3101409b9b4b9241d2ba7deaa93535a217a211c86c4cc7151fb12181/triton-3.0.0-1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e1efef76935b2febc365bfadf74bcb65a6f959a9872e5bddf44cc9e0adce1e1a", size = 209376304 }, From c1172a685a1b98c06849b9155a3e1ec93e6151ec Mon Sep 17 00:00:00 2001 From: Tony Kipkemboi Date: Thu, 2 Jan 2025 16:10:31 -0500 Subject: [PATCH 21/23] Update docs (#1842) * Update portkey docs * Add more examples to Knowledge docs + clarify issue with `embedder` * fix knowledge params and usage instructions --- docs/concepts/flows.mdx | 2 +- docs/concepts/knowledge.mdx | 205 ++++++++++++++++-- ...uardrails.md => portkey-observability.mdx} | 121 +++++------ docs/mint.json | 3 +- 4 files changed, 244 insertions(+), 87 deletions(-) rename docs/how-to/{Portkey-Observability-and-Guardrails.md => portkey-observability.mdx} (75%) diff --git a/docs/concepts/flows.mdx b/docs/concepts/flows.mdx index 324118310..cf9d20f63 100644 --- a/docs/concepts/flows.mdx +++ b/docs/concepts/flows.mdx @@ -138,7 +138,7 @@ print("---- Final Output ----") print(final_output) ```` -``` text Output +```text Output ---- Final Output ---- Second method received: Output from first_method ```` diff --git a/docs/concepts/knowledge.mdx b/docs/concepts/knowledge.mdx index 8a777833e..ba4f54450 100644 --- a/docs/concepts/knowledge.mdx +++ b/docs/concepts/knowledge.mdx @@ -4,8 +4,6 @@ description: What is knowledge in CrewAI and how to use it. icon: book --- -# Using Knowledge in CrewAI - ## What is Knowledge? Knowledge in CrewAI is a powerful system that allows AI agents to access and utilize external information sources during their tasks. @@ -36,7 +34,20 @@ CrewAI supports various types of knowledge sources out of the box: -## Quick Start +## Supported Knowledge Parameters + +| Parameter | Type | Required | Description | +| :--------------------------- | :---------------------------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `sources` | **List[BaseKnowledgeSource]** | Yes | List of knowledge sources that provide content to be stored and queried. Can include PDF, CSV, Excel, JSON, text files, or string content. | +| `collection_name` | **str** | No | Name of the collection where the knowledge will be stored. Used to identify different sets of knowledge. Defaults to "knowledge" if not provided. | +| `storage` | **Optional[KnowledgeStorage]** | No | Custom storage configuration for managing how the knowledge is stored and retrieved. If not provided, a default storage will be created. | + +## Quickstart Example + + +For file-Based Knowledge Sources, make sure to place your files in a `knowledge` directory at the root of your project. +Also, use relative paths from the `knowledge` directory when creating the source. + Here's an example using string-based knowledge: @@ -80,7 +91,8 @@ result = crew.kickoff(inputs={"question": "What city does John live in and how o ``` -Here's another example with the `CrewDoclingSource` +Here's another example with the `CrewDoclingSource`. The CrewDoclingSource is actually quite versatile and can handle multiple file formats including TXT, PDF, DOCX, HTML, and more. + ```python Code from crewai import LLM, Agent, Crew, Process, Task from crewai.knowledge.source.crew_docling_source import CrewDoclingSource @@ -128,39 +140,192 @@ result = crew.kickoff( ) ``` +## More Examples + +Here are examples of how to use different types of knowledge sources: + +### Text File Knowledge Source +```python +from crewai.knowledge.source import CrewDoclingSource + +# Create a text file knowledge source +text_source = CrewDoclingSource( + file_paths=["document.txt", "another.txt"] +) + +# Create knowledge with text file source +knowledge = Knowledge( + collection_name="text_knowledge", + sources=[text_source] +) +``` + +### PDF Knowledge Source +```python +from crewai.knowledge.source import PDFKnowledgeSource + +# Create a PDF knowledge source +pdf_source = PDFKnowledgeSource( + file_paths=["document.pdf", "another.pdf"] +) + +# Create knowledge with PDF source +knowledge = Knowledge( + collection_name="pdf_knowledge", + sources=[pdf_source] +) +``` + +### CSV Knowledge Source +```python +from crewai.knowledge.source import CSVKnowledgeSource + +# Create a CSV knowledge source +csv_source = CSVKnowledgeSource( + file_paths=["data.csv"] +) + +# Create knowledge with CSV source +knowledge = Knowledge( + collection_name="csv_knowledge", + sources=[csv_source] +) +``` + +### Excel Knowledge Source +```python +from crewai.knowledge.source import ExcelKnowledgeSource + +# Create an Excel knowledge source +excel_source = ExcelKnowledgeSource( + file_paths=["spreadsheet.xlsx"] +) + +# Create knowledge with Excel source +knowledge = Knowledge( + collection_name="excel_knowledge", + sources=[excel_source] +) +``` + +### JSON Knowledge Source +```python +from crewai.knowledge.source import JSONKnowledgeSource + +# Create a JSON knowledge source +json_source = JSONKnowledgeSource( + file_paths=["data.json"] +) + +# Create knowledge with JSON source +knowledge = Knowledge( + collection_name="json_knowledge", + sources=[json_source] +) +``` + ## Knowledge Configuration ### Chunking Configuration -Control how content is split for processing by setting the chunk size and overlap. +Knowledge sources automatically chunk content for better processing. +You can configure chunking behavior in your knowledge sources: -```python Code -knowledge_source = StringKnowledgeSource( - content="Long content...", - chunk_size=4000, # Characters per chunk (default) - chunk_overlap=200 # Overlap between chunks (default) +```python +from crewai.knowledge.source import StringKnowledgeSource + +source = StringKnowledgeSource( + content="Your content here", + chunk_size=4000, # Maximum size of each chunk (default: 4000) + chunk_overlap=200 # Overlap between chunks (default: 200) ) ``` -## Embedder Configuration +The chunking configuration helps in: +- Breaking down large documents into manageable pieces +- Maintaining context through chunk overlap +- Optimizing retrieval accuracy -You can also configure the embedder for the knowledge store. This is useful if you want to use a different embedder for the knowledge store than the one used for the agents. +### Embeddings Configuration -```python Code -... +You can also configure the embedder for the knowledge store. +This is useful if you want to use a different embedder for the knowledge store than the one used for the agents. +The `embedder` parameter supports various embedding model providers that include: +- `openai`: OpenAI's embedding models +- `google`: Google's text embedding models +- `azure`: Azure OpenAI embeddings +- `ollama`: Local embeddings with Ollama +- `vertexai`: Google Cloud VertexAI embeddings +- `cohere`: Cohere's embedding models +- `bedrock`: AWS Bedrock embeddings +- `huggingface`: Hugging Face models +- `watson`: IBM Watson embeddings + +Here's an example of how to configure the embedder for the knowledge store using Google's `text-embedding-004` model: + +```python Example +from crewai import Agent, Task, Crew, Process, LLM +from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource +import os + +# Get the GEMINI API key +GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY") + +# Create a knowledge source +content = "Users name is John. He is 30 years old and lives in San Francisco." string_source = StringKnowledgeSource( - content="Users name is John. He is 30 years old and lives in San Francisco.", + content=content, ) + +# Create an LLM with a temperature of 0 to ensure deterministic outputs +gemini_llm = LLM( + model="gemini/gemini-1.5-pro-002", + api_key=GEMINI_API_KEY, + temperature=0, +) + +# Create an agent with the knowledge store +agent = Agent( + role="About User", + goal="You know everything about the user.", + backstory="""You are a master at understanding people and their preferences.""", + verbose=True, + allow_delegation=False, + llm=gemini_llm, +) + +task = Task( + description="Answer the following questions about the user: {question}", + expected_output="An answer to the question.", + agent=agent, +) + crew = Crew( - ... + agents=[agent], + tasks=[task], + verbose=True, + process=Process.sequential, knowledge_sources=[string_source], embedder={ - "provider": "openai", - "config": {"model": "text-embedding-3-small"}, - }, + "provider": "google", + "config": { + "model": "models/text-embedding-004", + "api_key": GEMINI_API_KEY, + } + } ) -``` +result = crew.kickoff(inputs={"question": "What city does John live in and how old is he?"}) +``` +```text Output +# Agent: About User +## Task: Answer the following questions about the user: What city does John live in and how old is he? + +# Agent: About User +## Final Answer: +John is 30 years old and lives in San Francisco. +``` + ## Clearing Knowledge If you need to clear the knowledge stored in CrewAI, you can use the `crewai reset-memories` command with the `--knowledge` option. diff --git a/docs/how-to/Portkey-Observability-and-Guardrails.md b/docs/how-to/portkey-observability.mdx similarity index 75% rename from docs/how-to/Portkey-Observability-and-Guardrails.md rename to docs/how-to/portkey-observability.mdx index f4f7a696e..4002323a5 100644 --- a/docs/how-to/Portkey-Observability-and-Guardrails.md +++ b/docs/how-to/portkey-observability.mdx @@ -1,4 +1,9 @@ -# Portkey Integration with CrewAI +--- +title: Portkey Observability and Guardrails +description: How to use Portkey with CrewAI +icon: key +--- + Portkey CrewAI Header Image @@ -10,74 +15,69 @@ Portkey adds 4 core production capabilities to any CrewAI agent: 3. Full-stack tracing & cost, performance analytics 4. Real-time guardrails to enforce behavior - - - - ## Getting Started -1. **Install Required Packages:** + + + ```bash + pip install -qU crewai portkey-ai + ``` + + + To build CrewAI Agents with Portkey, you'll need two keys: + - **Portkey API Key**: Sign up on the [Portkey app](https://app.portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) and copy your API key + - **Virtual Key**: Virtual Keys securely manage your LLM API keys in one place. Store your LLM provider API keys securely in Portkey's vault -```bash -pip install -qU crewai portkey-ai -``` + ```python + from crewai import LLM + from portkey_ai import createHeaders, PORTKEY_GATEWAY_URL -2. **Configure the LLM Client:** - -To build CrewAI Agents with Portkey, you'll need two keys: -- **Portkey API Key**: Sign up on the [Portkey app](https://app.portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) and copy your API key -- **Virtual Key**: Virtual Keys securely manage your LLM API keys in one place. Store your LLM provider API keys securely in Portkey's vault - -```python -from crewai import LLM -from portkey_ai import createHeaders, PORTKEY_GATEWAY_URL - -gpt_llm = LLM( - model="gpt-4", - base_url=PORTKEY_GATEWAY_URL, - api_key="dummy", # We are using Virtual key - extra_headers=createHeaders( - api_key="YOUR_PORTKEY_API_KEY", - virtual_key="YOUR_VIRTUAL_KEY", # Enter your Virtual key from Portkey + gpt_llm = LLM( + model="gpt-4", + base_url=PORTKEY_GATEWAY_URL, + api_key="dummy", # We are using Virtual key + extra_headers=createHeaders( + api_key="YOUR_PORTKEY_API_KEY", + virtual_key="YOUR_VIRTUAL_KEY", # Enter your Virtual key from Portkey + ) ) -) -``` + ``` + + + ```python + from crewai import Agent, Task, Crew -3. **Create and Run Your First Agent:** + # Define your agents with roles and goals + coder = Agent( + role='Software developer', + goal='Write clear, concise code on demand', + backstory='An expert coder with a keen eye for software trends.', + llm=gpt_llm + ) -```python -from crewai import Agent, Task, Crew + # Create tasks for your agents + task1 = Task( + description="Define the HTML for making a simple website with heading- Hello World! Portkey is working!", + expected_output="A clear and concise HTML code", + agent=coder + ) -# Define your agents with roles and goals -coder = Agent( - role='Software developer', - goal='Write clear, concise code on demand', - backstory='An expert coder with a keen eye for software trends.', - llm=gpt_llm -) - -# Create tasks for your agents -task1 = Task( - description="Define the HTML for making a simple website with heading- Hello World! Portkey is working!", - expected_output="A clear and concise HTML code", - agent=coder -) - -# Instantiate your crew -crew = Crew( - agents=[coder], - tasks=[task1], -) - -result = crew.kickoff() -print(result) -``` + # Instantiate your crew + crew = Crew( + agents=[coder], + tasks=[task1], + ) + result = crew.kickoff() + print(result) + ``` + + ## Key Features | Feature | Description | -|---------|-------------| +|:--------|:------------| | 🌐 Multi-LLM Support | Access OpenAI, Anthropic, Gemini, Azure, and 250+ providers through a unified interface | | 🛡️ Production Reliability | Implement retries, timeouts, load balancing, and fallbacks | | 📊 Advanced Observability | Track 40+ metrics including costs, tokens, latency, and custom metadata | @@ -200,12 +200,3 @@ For detailed information on creating and managing Configs, visit the [Portkey do - [📊 Portkey Dashboard](https://app.portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) - [🐦 Twitter](https://twitter.com/portkeyai) - [💬 Discord Community](https://discord.gg/DD7vgKK299) - - - - - - - - - diff --git a/docs/mint.json b/docs/mint.json index fad9689b8..9103434b4 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -100,7 +100,8 @@ "how-to/conditional-tasks", "how-to/agentops-observability", "how-to/langtrace-observability", - "how-to/openlit-observability" + "how-to/openlit-observability", + "how-to/portkey-observability" ] }, { From 845951a0db8f84f5de041f341c6852c3feac3fa3 Mon Sep 17 00:00:00 2001 From: siddharth Sambharia Date: Fri, 3 Jan 2025 05:05:37 +0530 Subject: [PATCH 22/23] .md to .mdx and mint.json updated (no content changes) (#1836) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: siddharthsambharia-portkey Co-authored-by: João Moura --- .../portkey-observability-and-guardrails.mdx | 211 ++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 docs/how-to/portkey-observability-and-guardrails.mdx diff --git a/docs/how-to/portkey-observability-and-guardrails.mdx b/docs/how-to/portkey-observability-and-guardrails.mdx new file mode 100644 index 000000000..f4f7a696e --- /dev/null +++ b/docs/how-to/portkey-observability-and-guardrails.mdx @@ -0,0 +1,211 @@ +# Portkey Integration with CrewAI +Portkey CrewAI Header Image + + +[Portkey](https://portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) is a 2-line upgrade to make your CrewAI agents reliable, cost-efficient, and fast. + +Portkey adds 4 core production capabilities to any CrewAI agent: +1. Routing to **200+ LLMs** +2. Making each LLM call more robust +3. Full-stack tracing & cost, performance analytics +4. Real-time guardrails to enforce behavior + + + + + +## Getting Started + +1. **Install Required Packages:** + +```bash +pip install -qU crewai portkey-ai +``` + +2. **Configure the LLM Client:** + +To build CrewAI Agents with Portkey, you'll need two keys: +- **Portkey API Key**: Sign up on the [Portkey app](https://app.portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) and copy your API key +- **Virtual Key**: Virtual Keys securely manage your LLM API keys in one place. Store your LLM provider API keys securely in Portkey's vault + +```python +from crewai import LLM +from portkey_ai import createHeaders, PORTKEY_GATEWAY_URL + +gpt_llm = LLM( + model="gpt-4", + base_url=PORTKEY_GATEWAY_URL, + api_key="dummy", # We are using Virtual key + extra_headers=createHeaders( + api_key="YOUR_PORTKEY_API_KEY", + virtual_key="YOUR_VIRTUAL_KEY", # Enter your Virtual key from Portkey + ) +) +``` + +3. **Create and Run Your First Agent:** + +```python +from crewai import Agent, Task, Crew + +# Define your agents with roles and goals +coder = Agent( + role='Software developer', + goal='Write clear, concise code on demand', + backstory='An expert coder with a keen eye for software trends.', + llm=gpt_llm +) + +# Create tasks for your agents +task1 = Task( + description="Define the HTML for making a simple website with heading- Hello World! Portkey is working!", + expected_output="A clear and concise HTML code", + agent=coder +) + +# Instantiate your crew +crew = Crew( + agents=[coder], + tasks=[task1], +) + +result = crew.kickoff() +print(result) +``` + + +## Key Features + +| Feature | Description | +|---------|-------------| +| 🌐 Multi-LLM Support | Access OpenAI, Anthropic, Gemini, Azure, and 250+ providers through a unified interface | +| 🛡️ Production Reliability | Implement retries, timeouts, load balancing, and fallbacks | +| 📊 Advanced Observability | Track 40+ metrics including costs, tokens, latency, and custom metadata | +| 🔍 Comprehensive Logging | Debug with detailed execution traces and function call logs | +| 🚧 Security Controls | Set budget limits and implement role-based access control | +| 🔄 Performance Analytics | Capture and analyze feedback for continuous improvement | +| 💾 Intelligent Caching | Reduce costs and latency with semantic or simple caching | + + +## Production Features with Portkey Configs + +All features mentioned below are through Portkey's Config system. Portkey's Config system allows you to define routing strategies using simple JSON objects in your LLM API calls. You can create and manage Configs directly in your code or through the Portkey Dashboard. Each Config has a unique ID for easy reference. + + + + + + +### 1. Use 250+ LLMs +Access various LLMs like Anthropic, Gemini, Mistral, Azure OpenAI, and more with minimal code changes. Switch between providers or use them together seamlessly. [Learn more about Universal API](https://portkey.ai/docs/product/ai-gateway/universal-api) + + +Easily switch between different LLM providers: + +```python +# Anthropic Configuration +anthropic_llm = LLM( + model="claude-3-5-sonnet-latest", + base_url=PORTKEY_GATEWAY_URL, + api_key="dummy", + extra_headers=createHeaders( + api_key="YOUR_PORTKEY_API_KEY", + virtual_key="YOUR_ANTHROPIC_VIRTUAL_KEY", #You don't need provider when using Virtual keys + trace_id="anthropic_agent" + ) +) + +# Azure OpenAI Configuration +azure_llm = LLM( + model="gpt-4", + base_url=PORTKEY_GATEWAY_URL, + api_key="dummy", + extra_headers=createHeaders( + api_key="YOUR_PORTKEY_API_KEY", + virtual_key="YOUR_AZURE_VIRTUAL_KEY", #You don't need provider when using Virtual keys + trace_id="azure_agent" + ) +) +``` + + +### 2. Caching +Improve response times and reduce costs with two powerful caching modes: +- **Simple Cache**: Perfect for exact matches +- **Semantic Cache**: Matches responses for requests that are semantically similar +[Learn more about Caching](https://portkey.ai/docs/product/ai-gateway/cache-simple-and-semantic) + +```py +config = { + "cache": { + "mode": "semantic", # or "simple" for exact matching + } +} +``` + +### 3. Production Reliability +Portkey provides comprehensive reliability features: +- **Automatic Retries**: Handle temporary failures gracefully +- **Request Timeouts**: Prevent hanging operations +- **Conditional Routing**: Route requests based on specific conditions +- **Fallbacks**: Set up automatic provider failovers +- **Load Balancing**: Distribute requests efficiently + +[Learn more about Reliability Features](https://portkey.ai/docs/product/ai-gateway/) + + + +### 4. Metrics + +Agent runs are complex. Portkey automatically logs **40+ comprehensive metrics** for your AI agents, including cost, tokens used, latency, etc. Whether you need a broad overview or granular insights into your agent runs, Portkey's customizable filters provide the metrics you need. + + +- Cost per agent interaction +- Response times and latency +- Token usage and efficiency +- Success/failure rates +- Cache hit rates + +Portkey Dashboard + +### 5. Detailed Logging +Logs are essential for understanding agent behavior, diagnosing issues, and improving performance. They provide a detailed record of agent activities and tool use, which is crucial for debugging and optimizing processes. + + +Access a dedicated section to view records of agent executions, including parameters, outcomes, function calls, and errors. Filter logs based on multiple parameters such as trace ID, model, tokens used, and metadata. + +
+ Traces + Portkey Traces +
+ +
+ Logs + Portkey Logs +
+ +### 6. Enterprise Security Features +- Set budget limit and rate limts per Virtual Key (disposable API keys) +- Implement role-based access control +- Track system changes with audit logs +- Configure data retention policies + + + +For detailed information on creating and managing Configs, visit the [Portkey documentation](https://docs.portkey.ai/product/ai-gateway/configs). + +## Resources + +- [📘 Portkey Documentation](https://docs.portkey.ai) +- [📊 Portkey Dashboard](https://app.portkey.ai/?utm_source=crewai&utm_medium=crewai&utm_campaign=crewai) +- [🐦 Twitter](https://twitter.com/portkeyai) +- [💬 Discord Community](https://discord.gg/DD7vgKK299) + + + + + + + + + From bfe2c44f55a704b8235d9042711b06862296a63d Mon Sep 17 00:00:00 2001 From: Marco Vinciguerra <88108002+VinciGit00@users.noreply.github.com> Date: Fri, 3 Jan 2025 00:42:08 +0100 Subject: [PATCH 23/23] feat: add documentation functions (#1831) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add docstring * feat: add new docstring * fix: linting --------- Co-authored-by: João Moura --- src/crewai/project/annotations.py | 13 +++++++++++++ src/crewai/project/crew_base.py | 2 ++ src/crewai/utilities/crew_json_encoder.py | 3 +++ src/crewai/utilities/crew_pydantic_output_parser.py | 3 ++- src/crewai/utilities/i18n.py | 2 ++ src/crewai/utilities/paths.py | 3 +++ src/crewai/utilities/planning_handler.py | 5 ++++- src/crewai/utilities/printer.py | 4 ++++ src/crewai/utilities/rpm_controller.py | 2 ++ src/crewai/utilities/task_output_storage_handler.py | 4 ++++ 10 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/crewai/project/annotations.py b/src/crewai/project/annotations.py index bf0051c4d..d7c636ccf 100644 --- a/src/crewai/project/annotations.py +++ b/src/crewai/project/annotations.py @@ -4,18 +4,23 @@ from typing import Callable from crewai import Crew from crewai.project.utils import memoize +"""Decorators for defining crew components and their behaviors.""" + def before_kickoff(func): + """Marks a method to execute before crew kickoff.""" func.is_before_kickoff = True return func def after_kickoff(func): + """Marks a method to execute after crew kickoff.""" func.is_after_kickoff = True return func def task(func): + """Marks a method as a crew task.""" func.is_task = True @wraps(func) @@ -29,43 +34,51 @@ def task(func): def agent(func): + """Marks a method as a crew agent.""" func.is_agent = True func = memoize(func) return func def llm(func): + """Marks a method as an LLM provider.""" func.is_llm = True func = memoize(func) return func def output_json(cls): + """Marks a class as JSON output format.""" cls.is_output_json = True return cls def output_pydantic(cls): + """Marks a class as Pydantic output format.""" cls.is_output_pydantic = True return cls def tool(func): + """Marks a method as a crew tool.""" func.is_tool = True return memoize(func) def callback(func): + """Marks a method as a crew callback.""" func.is_callback = True return memoize(func) def cache_handler(func): + """Marks a method as a cache handler.""" func.is_cache_handler = True return memoize(func) def crew(func) -> Callable[..., Crew]: + """Marks a method as the main crew execution point.""" @wraps(func) def wrapper(self, *args, **kwargs) -> Crew: diff --git a/src/crewai/project/crew_base.py b/src/crewai/project/crew_base.py index 0b43882f2..ea518be70 100644 --- a/src/crewai/project/crew_base.py +++ b/src/crewai/project/crew_base.py @@ -9,8 +9,10 @@ load_dotenv() T = TypeVar("T", bound=type) +"""Base decorator for creating crew classes with configuration and function management.""" def CrewBase(cls: T) -> T: + """Wraps a class with crew functionality and configuration management.""" class WrappedClass(cls): # type: ignore is_crew_class: bool = True # type: ignore diff --git a/src/crewai/utilities/crew_json_encoder.py b/src/crewai/utilities/crew_json_encoder.py index 298c9681a..6e667431d 100644 --- a/src/crewai/utilities/crew_json_encoder.py +++ b/src/crewai/utilities/crew_json_encoder.py @@ -1,3 +1,5 @@ +"""JSON encoder for handling CrewAI specific types.""" + import json from datetime import date, datetime from decimal import Decimal @@ -8,6 +10,7 @@ from pydantic import BaseModel class CrewJSONEncoder(json.JSONEncoder): + """Custom JSON encoder for CrewAI objects and special types.""" def default(self, obj): if isinstance(obj, BaseModel): return self._handle_pydantic_model(obj) diff --git a/src/crewai/utilities/crew_pydantic_output_parser.py b/src/crewai/utilities/crew_pydantic_output_parser.py index c269f3189..d0dbfae06 100644 --- a/src/crewai/utilities/crew_pydantic_output_parser.py +++ b/src/crewai/utilities/crew_pydantic_output_parser.py @@ -6,9 +6,10 @@ from pydantic import BaseModel, ValidationError from crewai.agents.parser import OutputParserException +"""Parser for converting text outputs into Pydantic models.""" class CrewPydanticOutputParser: - """Parses the text into pydantic models""" + """Parses text outputs into specified Pydantic models.""" pydantic_object: Type[BaseModel] diff --git a/src/crewai/utilities/i18n.py b/src/crewai/utilities/i18n.py index ebf1abcda..f2540e455 100644 --- a/src/crewai/utilities/i18n.py +++ b/src/crewai/utilities/i18n.py @@ -4,8 +4,10 @@ from typing import Dict, Optional, Union from pydantic import BaseModel, Field, PrivateAttr, model_validator +"""Internationalization support for CrewAI prompts and messages.""" class I18N(BaseModel): + """Handles loading and retrieving internationalized prompts.""" _prompts: Dict[str, Dict[str, str]] = PrivateAttr() prompt_file: Optional[str] = Field( default=None, diff --git a/src/crewai/utilities/paths.py b/src/crewai/utilities/paths.py index 51cf8b4e4..9bf167ee6 100644 --- a/src/crewai/utilities/paths.py +++ b/src/crewai/utilities/paths.py @@ -3,8 +3,10 @@ from pathlib import Path import appdirs +"""Path management utilities for CrewAI storage and configuration.""" def db_storage_path(): + """Returns the path for database storage.""" app_name = get_project_directory_name() app_author = "CrewAI" @@ -14,6 +16,7 @@ def db_storage_path(): def get_project_directory_name(): + """Returns the current project directory name.""" project_directory_name = os.environ.get("CREWAI_STORAGE_DIR") if project_directory_name: diff --git a/src/crewai/utilities/planning_handler.py b/src/crewai/utilities/planning_handler.py index 21ee093a1..9092dedda 100644 --- a/src/crewai/utilities/planning_handler.py +++ b/src/crewai/utilities/planning_handler.py @@ -7,10 +7,11 @@ from pydantic import BaseModel, Field from crewai.agent import Agent from crewai.task import Task +"""Handles planning and coordination of crew tasks.""" logger = logging.getLogger(__name__) - class PlanPerTask(BaseModel): + """Represents a plan for a specific task.""" task: str = Field(..., description="The task for which the plan is created") plan: str = Field( ..., @@ -19,6 +20,7 @@ class PlanPerTask(BaseModel): class PlannerTaskPydanticOutput(BaseModel): + """Output format for task planning results.""" list_of_plans_per_task: List[PlanPerTask] = Field( ..., description="Step by step plan on how the agents can execute their tasks using the available tools with mastery", @@ -26,6 +28,7 @@ class PlannerTaskPydanticOutput(BaseModel): class CrewPlanner: + """Plans and coordinates the execution of crew tasks.""" def __init__(self, tasks: List[Task], planning_agent_llm: Optional[Any] = None): self.tasks = tasks diff --git a/src/crewai/utilities/printer.py b/src/crewai/utilities/printer.py index edb339c29..abebf6aae 100644 --- a/src/crewai/utilities/printer.py +++ b/src/crewai/utilities/printer.py @@ -1,7 +1,11 @@ +"""Utility for colored console output.""" + from typing import Optional class Printer: + """Handles colored console output formatting.""" + def print(self, content: str, color: Optional[str] = None): if color == "purple": self._print_purple(content) diff --git a/src/crewai/utilities/rpm_controller.py b/src/crewai/utilities/rpm_controller.py index 5ee054c5f..f2d90615c 100644 --- a/src/crewai/utilities/rpm_controller.py +++ b/src/crewai/utilities/rpm_controller.py @@ -6,8 +6,10 @@ from pydantic import BaseModel, Field, PrivateAttr, model_validator from crewai.utilities.logger import Logger +"""Controls request rate limiting for API calls.""" class RPMController(BaseModel): + """Manages requests per minute limiting.""" max_rpm: Optional[int] = Field(default=None) logger: Logger = Field(default_factory=lambda: Logger(verbose=False)) _current_rpm: int = PrivateAttr(default=0) diff --git a/src/crewai/utilities/task_output_storage_handler.py b/src/crewai/utilities/task_output_storage_handler.py index 34cdaccbb..80e749bee 100644 --- a/src/crewai/utilities/task_output_storage_handler.py +++ b/src/crewai/utilities/task_output_storage_handler.py @@ -8,8 +8,10 @@ from crewai.memory.storage.kickoff_task_outputs_storage import ( ) from crewai.task import Task +"""Handles storage and retrieval of task execution outputs.""" class ExecutionLog(BaseModel): + """Represents a log entry for task execution.""" task_id: str expected_output: Optional[str] = None output: Dict[str, Any] @@ -22,6 +24,8 @@ class ExecutionLog(BaseModel): return getattr(self, key) +"""Manages storage and retrieval of task outputs.""" + class TaskOutputStorageHandler: def __init__(self) -> None: self.storage = KickoffTaskOutputsSQLiteStorage()