-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add Azure integration #2
Conversation
e36992b
to
4f9331a
Compare
Thanks @aavetis! I've added some 2 missing references (and also updated the Reg the docs specifically - I'm not sure why you need all the code you wrote. Specifically around manually creating spans, and re-defining the span processor. This should also work: from traceloop.sdk import Traceloop
from traceloop.sdk.decorators import workflow
from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
import openai # Ensure you have the openai library installed
# Configure the tracer provider to export traces to Azure Application Insights
exporter = AzureMonitorTraceExporter(connection_string="INSERT_CONNECTION_STRING_HERE")
Traceloop.init(app_name="your_app_name", exporter=exporter)
@workflow(name="llm_execution")
def execute_llm():
# Replace with your actual OpenAI API call
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Hello world"}],
max_tokens=60
)
return response['choices'][0]['message']['content']
if __name__ == "__main__":
execute_llm() If I'm right, then I'd try to keep this simple and just mention how to initialize the Azure exporter and pass it to the exporter = AzureMonitorTraceExporter(connection_string="INSERT_CONNECTION_STRING_HERE")
Traceloop.init(app_name="your_app_name", exporter=exporter) |
@aavetis do you plan to continue working on that? |
apologies for the delay |
Thanks @aavetis! :) Mind rebasing so I can merge this? |
Co-authored-by: Nir Gazit <nirga@users.noreply.github.com>
note! did not test / compile docs locally; did the entire change in browser - please verify