From a2ebeef4e97583ff95fdaa02bca156fe1137d2b5 Mon Sep 17 00:00:00 2001 From: coderay3000 Date: Sun, 9 Aug 2026 16:40:50 +0530 Subject: [PATCH] fix(alephalpha): update client import and fix lint issues --- .../examples/basic_tracing.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/opentelemetry-instrumentation-alephalpha/examples/basic_tracing.py diff --git a/packages/opentelemetry-instrumentation-alephalpha/examples/basic_tracing.py b/packages/opentelemetry-instrumentation-alephalpha/examples/basic_tracing.py new file mode 100644 index 0000000000..55c7b91c6b --- /dev/null +++ b/packages/opentelemetry-instrumentation-alephalpha/examples/basic_tracing.py @@ -0,0 +1,26 @@ +import os +from aleph_alpha_client import Client, CompletionRequest, Prompt +from opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor + +# 1. Initialize OpenTelemetry Instrumentation +AlephAlphaInstrumentor().instrument() + +# 2. Get API Key +api_token = os.getenv("ALEPH_ALPHA_API_KEY") +if not api_token: + raise ValueError("ALEPH_ALPHA_API_KEY environment variable is missing.") + +# 3. Create Aleph Alpha Client +client = Client(token=api_token) + +# 4. Send Completion Request +request = CompletionRequest( + prompt=Prompt.from_text("What is OpenTelemetry?"), + maximum_tokens=50, +) +response = client.complete(request, model="luminous-base") + +# 5. Print Response Output +if response.completions: + print("\n--- Response ---") + print(response.completions[0].completion) \ No newline at end of file