Skip to content

Tracer: support traceable attribute #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025
Merged

Conversation

ionmincu
Copy link
Contributor

@ionmincu ionmincu commented Apr 4, 2025

Description

Add support for @traceable to be traced in uipath traces as well.
Some functionalities may be missing.

Examples

@traceable(run_type="llm", name="OpenAI Call Decorator", tags=["my-tag"],  metadata={"my-key": "my-value"} )
def simple_func2(a, b):
    print("Hello from simple func2: ", a, b)
    pass

@traceable
def simple_func(param_a, param_b):
    """A simple function to demonstrate the workflow."""
    print("Hello from simple func")

    return param_a + param_b

@traceable
async def simple_async(a, b, c):
    """A simple async function to demonstrate the workflow."""
    print("Hello from simple async")
    await asyncio.sleep(1)
    return "simple_async_result"

@traceable(run_type="llm", name="OpenAI Call Decorator")
async def simple_async_with_params(a, b, c):
    """A simple async function to demonstrate the workflow."""
    print("Hello from simple async")
    await asyncio.sleep(1)
    return "simple_async_with_params_result"

@traceable(run_type="llm", name="OpenAI Call Decorator")
async def generator_async_with_params(a, b, c):
    yield "Hello from generator async"
    await asyncio.sleep(1)

    yield 123
    yield "abcd"

@traceable(run_type="llm", name="OpenAI Call Decorator")
def generator_with_params(a, b, c):
    yield "Hello from generator"
    yield 123
    yield "abcd"

@ionmincu ionmincu requested a review from cristipufu April 4, 2025 12:42
@ionmincu ionmincu self-assigned this Apr 4, 2025
@ionmincu ionmincu force-pushed the feature/add_traceable branch 18 times, most recently from 4223ff6 to 522ba7f Compare April 4, 2025 14:42
@ionmincu ionmincu force-pushed the feature/add_traceable branch from 522ba7f to 6b3939d Compare April 4, 2025 14:44
@ionmincu ionmincu force-pushed the feature/add_traceable branch from 6b3939d to 3b69572 Compare April 4, 2025 14:45
@ionmincu ionmincu merged commit e6b9137 into main Apr 4, 2025
5 checks passed
@ionmincu ionmincu deleted the feature/add_traceable branch April 4, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants