diff --git a/README.md b/README.md index 37ce6e89..f4a4a409 100644 --- a/README.md +++ b/README.md @@ -64,11 +64,7 @@ Initialize the AgentOps client and automatically get analytics on every LLM call import agentops # Beginning of program's code (i.e. main.py, __init__.py) -agentops.init( < INSERT -YOUR -API -KEY -HERE >) +agentops.init( < INSERT YOUR API KEY HERE >) ... diff --git a/agentops/decorators.py b/agentops/decorators.py index 2f3143cb..3c74ce8d 100644 --- a/agentops/decorators.py +++ b/agentops/decorators.py @@ -39,7 +39,7 @@ async def async_wrapper(*args, session: Optional[Session] = None, **kwargs): if session is None: if Client().is_multi_session: raise ValueError( - "If multiple sessions exists, `session` is a required parameter in the function decorated by @record_function" + "If multiple sessions exists, `session` is a required parameter in the function decorated by @record_action" ) func_args = inspect.signature(func).parameters arg_names = list(func_args.keys()) @@ -100,7 +100,7 @@ def sync_wrapper(*args, session: Optional[Session] = None, **kwargs): if session is None: if Client().is_multi_session: raise ValueError( - "If multiple sessions exists, `session` is a required parameter in the function decorated by @record_function" + "If multiple sessions exists, `session` is a required parameter in the function decorated by @record_action" ) func_args = inspect.signature(func).parameters arg_names = list(func_args.keys()) diff --git a/docs/v1/concepts/events.mdx b/docs/v1/concepts/events.mdx index 0400f4f5..a413fafa 100644 --- a/docs/v1/concepts/events.mdx +++ b/docs/v1/concepts/events.mdx @@ -26,14 +26,14 @@ The `ActionEvent` is a generic event for recording events that do not fit into t | logs | str | None | "Executed action successfully" | Logs generated during the action event | | screenshot | str | None | "/path/to/screenshot.png" | Path to screenshot captured during the action event | -An action event can be used the [same way as other events](/v1/usage/recording-events) but also with the `record_function` -decorator. +An action or tool event can be used the [same way as other events](/v1/usage/recording-events) but also with the `record_action` or `record_tool` +decorators. ```python python -from agentops import record_function +from agentops import record_action -@record_function() +@record_action() def some_action(params): return "some response" ``` diff --git a/docs/v1/examples/notebooks/openai-gpt.html b/docs/v1/examples/notebooks/openai-gpt.html index 51a79bdd..dc112599 100644 --- a/docs/v1/examples/notebooks/openai-gpt.html +++ b/docs/v1/examples/notebooks/openai-gpt.html @@ -307,10 +307,10 @@

Events

from agentops import record_function
+class="sourceCode python">from agentops import record_action
 
 
-@record_function("add numbers")
+@record_action("add numbers")
 def add(x, y):
     return x + y
 
diff --git a/docs/v1/quickstart.mdx b/docs/v1/quickstart.mdx
index 889b5dbd..9dc09f37 100644
--- a/docs/v1/quickstart.mdx
+++ b/docs/v1/quickstart.mdx
@@ -47,12 +47,12 @@ import EnvTooltip from '/snippets/add-env-tooltip.mdx'
 
 
 
-  You can instrument other functions inside your code with the handy `@record_function`
+  You can instrument other functions inside your code with the handy `@record_action`
   decorator, which will record an `action_type`, the parameters, and the returns. You
   will see these function calls alongside your LLM calls from instantiating the AgentOps client.
   ```python python
   # (record specific functions)
-  @agentops.record_function('sample function being record')
+  @agentops.record_action('sample function being record')
   def sample_function(...):
     ...
 ```
@@ -94,7 +94,7 @@ import agentops
 agentops.init()
 
 # (record specific functions)
-@agentops.record_function('sample function being record')
+@agentops.record_action('sample function being record')
 def sample_function(...):
   ...
 
diff --git a/docs/v1/usage/recording-events.mdx b/docs/v1/usage/recording-events.mdx
index 3a94ffe2..f7fec071 100644
--- a/docs/v1/usage/recording-events.mdx
+++ b/docs/v1/usage/recording-events.mdx
@@ -6,12 +6,12 @@ description: "Log events such as agent actions, LLM calls, tool calls, and error
 To get the most out of AgentOps, it is best to carefully consider what events to record -
 not simply record whatever your agent is logging. AgentOps offers two ways to record events:
 
-## `@record_function` Decorator
+## `@record_action` Decorator
 
 - **`event_type`** (str): Type of the event.
 
-To make AgentOps easier to integrate, we also provide a function decorator to automatically creates
-and records an event for your function.
+To make AgentOps easier to integrate, we also provide a function decorator to automatically create
+and record an event for your function.
 
 ```python python
 from agentops import record_action
@@ -23,6 +23,23 @@ def sample_function(...):
 
 The decorator will record the function's parameters, returns, and the time duration. We suggest using this on functions that take a long time and contain nested functions. For example, if you decorate a function that makes several openai calls, then each openai call will show in the replay graph as a child of the decorated function.
 
+## `@record_tool` Decorator
+
+- **`tool_name`** (str): The name of the tool represented by the python function
+
+Additionally, we provide a function decorator to automatically create tool events for python functions.
+
+```python python
+from agentops import record_tool
+
+@record_tool('SampleToolName')
+def sample_tool(...):
+    ...
+```
+
+The decorator will record the function's parameters, returns, and the time duration. We suggest using this on functions that take a long time and contain nested functions. For example, if you decorate a function that makes several openai calls, then each openai call will show in the replay graph as a child of the decorated function.
+
+
 ## `record()` Method
 
 From this point, simply call the .record() method in the AgentOps client:
diff --git a/examples/openai-gpt.ipynb b/examples/openai-gpt.ipynb
index ef3e63f3..6b9bfd1d 100644
--- a/examples/openai-gpt.ipynb
+++ b/examples/openai-gpt.ipynb
@@ -182,10 +182,10 @@
    },
    "outputs": [],
    "source": [
-    "from agentops import record_function\n",
+    "from agentops import record_action\n",
     "\n",
     "\n",
-    "@record_function(\"add numbers\")\n",
+    "@record_action(\"add numbers\")\n",
     "def add(x, y):\n",
     "    return x + y\n",
     "\n",
diff --git a/examples/recording-events.ipynb b/examples/recording-events.ipynb
index 018b6344..b766a716 100644
--- a/examples/recording-events.ipynb
+++ b/examples/recording-events.ipynb
@@ -66,10 +66,10 @@
    },
    "outputs": [],
    "source": [
-    "from agentops import record_function\n",
+    "from agentops import record_action\n",
     "\n",
     "\n",
-    "@record_function(\"add numbers\")\n",
+    "@record_action(\"add numbers\")\n",
     "def add(x, y):\n",
     "    return x + y\n",
     "\n",