mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
fix(telemetry): library client does not log span (#1833)
This commit is contained in:
parent
d8a8a734b5
commit
3a2314dcef
2 changed files with 2 additions and 8 deletions
|
@ -328,8 +328,9 @@ class AsyncLlamaStackAsLibraryClient(AsyncLlamaStackClient):
|
||||||
|
|
||||||
body = self._convert_body(path, options.method, body)
|
body = self._convert_body(path, options.method, body)
|
||||||
|
|
||||||
async def gen():
|
|
||||||
await start_trace(route, {"__location__": "library_client"})
|
await start_trace(route, {"__location__": "library_client"})
|
||||||
|
|
||||||
|
async def gen():
|
||||||
try:
|
try:
|
||||||
async for chunk in await func(**body):
|
async for chunk in await func(**body):
|
||||||
data = json.dumps(convert_pydantic_to_json_value(chunk))
|
data = json.dumps(convert_pydantic_to_json_value(chunk))
|
||||||
|
|
|
@ -7,16 +7,10 @@
|
||||||
import time
|
import time
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
import pytest
|
|
||||||
from llama_stack_client import Agent
|
from llama_stack_client import Agent
|
||||||
|
|
||||||
from llama_stack.distribution.library_client import LlamaStackAsLibraryClient
|
|
||||||
|
|
||||||
|
|
||||||
def test_agent_query_spans(llama_stack_client, text_model_id):
|
def test_agent_query_spans(llama_stack_client, text_model_id):
|
||||||
if isinstance(llama_stack_client, LlamaStackAsLibraryClient):
|
|
||||||
pytest.mark.xfail(reason="Need to fix LlamaStackAsLibraryClient to log spans")
|
|
||||||
|
|
||||||
agent = Agent(llama_stack_client, model=text_model_id, instructions="You are a helpful assistant")
|
agent = Agent(llama_stack_client, model=text_model_id, instructions="You are a helpful assistant")
|
||||||
session_id = agent.create_session(f"test-session-{uuid4()}")
|
session_id = agent.create_session(f"test-session-{uuid4()}")
|
||||||
agent.create_turn(
|
agent.create_turn(
|
||||||
|
@ -41,7 +35,6 @@ def test_agent_query_spans(llama_stack_client, text_model_id):
|
||||||
],
|
],
|
||||||
attributes_to_return=["input", "output"],
|
attributes_to_return=["input", "output"],
|
||||||
):
|
):
|
||||||
print(span.attributes)
|
|
||||||
if span.attributes["output"] != "no shields":
|
if span.attributes["output"] != "no shields":
|
||||||
agent_logs.append(span.attributes)
|
agent_logs.append(span.attributes)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue