-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi, You are doing great work with your library! I like the UI a lot and still in the progress of learning about all the things you can do with Braintrust.
I'm having a little problem with the hierarchy of my span. So I'm creating a custom Agent-loop for my application. I have figured out stuff like marking spans as tool calls or LLM calls and such. How ever when I have a tool call that does OpenAI call the OpenAI call gets logged, but it is not under the tool call but after it as seen in the screenshot taken from your UI. I'll include a small (non-working) example code of my situation also to make the situation hopefully more clear. Am I forgetting to do something here or is this a limitation in your SDK?
def call_search(args):
query = args["query"]
# Custom wrapper for openai client to embed a phrase. Uses wrap_openai(openai.AsyncOpenAi()) under the hood
embed = llm_embed(query)
# Rest of some vector search functionality
return results
@traced
def tool_caller(tool_name: str, args: Any):
if tool.name == "search":
result = call_search(args)
return result
def my_agent_loop():
context = ...
while True:
call_result = call_agent(context)
if call_result.tool_calls:
for tool_call in call_result.tool_calls:
result = tool_caller(tool_call.name, tool_call.args)
context.append(result)I'm using the latest Python SDK
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels