HyperDX¶
Mirascope provides out-of-the-box integration with HyperDX.
You can install the necessary packages directly or using the hyperdx
extras flag:
You can then use the with_hyperdx
decorator to automatically log calls:
from mirascope.core import Messages, anthropic
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@anthropic.call(model="claude-3-5-sonnet-20240620")
def recommend_book(genre: str) -> Messages.Type:
return Messages.User(f"Recommend a {genre} book.")
print(recommend_book("fantasy"))
from mirascope.core import Messages, anthropic
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@anthropic.call(model="claude-3-5-sonnet-20240620")
def recommend_book(genre: str) -> Messages.Type:
return Messages.User(f"Recommend a {genre} book.")
print(recommend_book("fantasy"))
from mirascope.core import BaseMessageParam, anthropic
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@anthropic.call(model="claude-3-5-sonnet-20240620")
def recommend_book(genre: str) -> list[BaseMessageParam]:
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book.")]
print(recommend_book("fantasy"))
from mirascope.core import BaseMessageParam, anthropic
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@anthropic.call("claude-3-5-sonnet-20240620")
def recommend_book(genre: str) -> list[BaseMessageParam]:
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")]
print(recommend_book("fantasy"))
from mirascope.core import BaseMessageParam, mistral
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@mistral.call("mistral-large-latest")
def recommend_book(genre: str) -> list[BaseMessageParam]:
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")]
print(recommend_book("fantasy"))
from mirascope.core import BaseMessageParam, groq
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@groq.call("llama-3.1-70b-versatile")
def recommend_book(genre: str) -> list[BaseMessageParam]:
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")]
print(recommend_book("fantasy"))
from mirascope.core import BaseMessageParam, cohere
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@cohere.call("command-r-plus")
def recommend_book(genre: str) -> list[BaseMessageParam]:
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")]
print(recommend_book("fantasy"))
from mirascope.core import BaseMessageParam, litellm
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@litellm.call("gpt-4o-mini")
def recommend_book(genre: str) -> list[BaseMessageParam]:
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")]
print(recommend_book("fantasy"))
from mirascope.core import BaseMessageParam, azure
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@azure.call("gpt-4o-mini")
def recommend_book(genre: str) -> list[BaseMessageParam]:
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book")]
print(recommend_book("fantasy"))
from mirascope.core import BaseMessageParam, bedrock
from mirascope.integrations.otel import with_hyperdx
@with_hyperdx()
@bedrock.call(model="claude-3-5-sonnet-20240620")
def recommend_book(genre: str) -> list[BaseMessageParam]:
return [BaseMessageParam(role="user", content=f"Recommend a {genre} book.")]
print(recommend_book("fantasy"))
This decorator is a simple wrapper on top of our OpenTelemetry integration