Skip to content
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

[Bug]: Langsmith async integration doesn't register traces #6862

Open
tomukmatthews opened this issue Nov 21, 2024 · 0 comments
Open

[Bug]: Langsmith async integration doesn't register traces #6862

tomukmatthews opened this issue Nov 21, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@tomukmatthews
Copy link

What happened?

I ran this, following the docs but it didn't register any trace.

Using langsmith's @traceable decorator does pick up the traces, but i currently can't send in metadata dynamically with litellm.

import asyncio
import os
import litellm

os.environ["LANGSMITH_API_KEY"] = "..."
os.environ["LANGSMITH_PROJECT"] = "test"  # defaults to litellm-completion
os.environ["LANGSMITH_TRACING_V2"] = "true"
# LLM API Keys
os.environ["OPENAI_API_KEY"] = "..."


# set langsmith as a callback, litellm will send the data to langsmith
litellm.success_callback = ["langsmith"]

async def main():
    # openai call
    response = await litellm.acompletion(
        model="gpt-3.5-turbo",
        messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}],
        metadata={
            "run_name": "litellmRUN",  # langsmith run name
            "project_name": "test",  # langsmith project name
            "run_id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  # langsmith run id
            "parent_run_id": "f8faf8c1-9778-49a4-9004-628cdb0047e5",  # langsmith run parent run id
            "trace_id": "df570c03-5a03-4cea-8df0-c162d05127ac",  # langsmith run trace id
            "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",  # langsmith run session id
            "tags": ["model1", "prod-2"],  # langsmith run tags
            "metadata": {"key1": "value1"},  # langsmith run metadata
            "dotted_order": "20240429T004912090000Z497f6eca-6276-4993-bfeb-53cbbbba6f08",
        },
    )
    print(response)


if __name__ == "__main__":
    asyncio.run(main())

Relevant log output

No response

Twitter / LinkedIn details

No response

@tomukmatthews tomukmatthews added the bug Something isn't working label Nov 21, 2024
@krrishdholakia krrishdholakia self-assigned this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants