Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
_instruments = ("qdrant-client >= 1.7",)

p = Path(__file__).with_name("qdrant_client_methods.json")
with open(p, "r") as f:
# with open(p, "r") as f: --first version of the file was not utf-8 encoded, so we need to specify encoding
with open(p, "r", encoding="utf-8") as f:
QDRANT_CLIENT_METHODS = json.loads(f.read())

p = Path(__file__).with_name("async_qdrant_client_methods.json")
with open(p, "r") as f:
# with open(p, "r") as f: the same as above, we need to specify encoding
with open(p, "r", encoding="utf-8") as f:
ASYNC_QDRANT_CLIENT_METHODS = json.loads(f.read())

WRAPPED_METHODS = QDRANT_CLIENT_METHODS + ASYNC_QDRANT_CLIENT_METHODS
Expand Down
3 changes: 3 additions & 0 deletions packages/sample-app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies = [
"fastmcp>=2.12.3,<3",
"agno>=2.4.0,<3",
"voyageai>=0.3.7",
"aleph-alpha-client>=7.1.0,<8",
"opentelemetry-instrumentation-openai",
"opentelemetry-instrumentation-haystack",
"opentelemetry-instrumentation-pinecone",
Expand All @@ -64,6 +65,7 @@ dependencies = [
"opentelemetry-instrumentation-anthropic",
"opentelemetry-instrumentation-bedrock",
"opentelemetry-instrumentation-voyageai",
"opentelemetry-instrumentation-alephalpha",
"traceloop-sdk",
]

Expand All @@ -84,6 +86,7 @@ opentelemetry-instrumentation-agno = { path = "../opentelemetry-instrumentation-
opentelemetry-instrumentation-anthropic = { path = "../opentelemetry-instrumentation-anthropic", editable = true }
opentelemetry-instrumentation-bedrock = { path = "../opentelemetry-instrumentation-bedrock", editable = true }
opentelemetry-instrumentation-voyageai = { path = "../opentelemetry-instrumentation-voyageai", editable = true }
opentelemetry-instrumentation-alephalpha = { path = "../opentelemetry-instrumentation-alephalpha", editable = true }
traceloop-sdk = { path = "../traceloop-sdk", editable = true }

[dependency-groups]
Expand Down
31 changes: 31 additions & 0 deletions packages/sample-app/sample_app/alephalpha_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os

from aleph_alpha_client import Client, CompletionRequest, Prompt
from traceloop.sdk import Traceloop
from traceloop.sdk.decorators import task, workflow


Traceloop.init(app_name="alephalpha_example")

client = Client(token=os.environ.get("ALEPH_ALPHA_API_KEY") or os.environ.get("AA_TOKEN"))


@task(name="complete_prompt")
def complete_prompt():
request = CompletionRequest(
prompt=Prompt.from_text("Tell me one sentence about OpenTelemetry."),
maximum_tokens=64,
)

response = client.complete(request, model="luminous-base")
return response.completions[0].completion


@workflow(name="alephalpha_completion_demo")
def alephalpha_completion_demo():
completion = complete_prompt()
print(completion)


if __name__ == "__main__":
alephalpha_completion_demo()
3 changes: 2 additions & 1 deletion scripts/codegen/generate_evaluator_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def extract_definitions_and_mappings(swagger_path: str) -> tuple[dict, dict]:
tuple: (filtered_definitions, slug_mappings)
slug_mappings: {slug: {"request": "ModelName", "response": "ModelName"}}
"""
with open(swagger_path) as f:
# with open(swagger_path) as f: the same as above, we need to specify encoding
with open(swagger_path, encoding="utf-8") as f:
data = json.load(f)

all_definitions = data["definitions"]
Expand Down