@@ -34,9 +34,6 @@ type Traceloop struct {
3434 http.Client
3535}
3636
37- type LLMSpan struct {
38- span apitrace.Span
39- }
4037
4138func NewClient (ctx context.Context , config Config ) (* Traceloop , error ) {
4239 instance := Traceloop {
@@ -175,22 +172,8 @@ func (instance *Traceloop) LogPrompt(ctx context.Context, prompt Prompt, workflo
175172 }, nil
176173}
177174
178- func (llmSpan * LLMSpan ) LogCompletion (ctx context.Context , completion Completion , usage Usage ) error {
179- llmSpan .span .SetAttributes (
180- semconvai .LLMResponseModel .String (completion .Model ),
181- semconvai .LLMUsageTotalTokens .Int (usage .TotalTokens ),
182- semconvai .LLMUsageCompletionTokens .Int (usage .CompletionTokens ),
183- semconvai .LLMUsagePromptTokens .Int (usage .PromptTokens ),
184- )
185-
186- setMessagesAttribute (llmSpan .span , "llm.completions" , completion .Messages )
187-
188- defer llmSpan .span .End ()
189- return nil
190- }
191-
192175// LogToolCall logs a tool call with the specified name
193- func (instance * Traceloop ) LogToolCall (ctx context.Context , attrs ToolCallAttributes , workflowAttrs WorkflowAttributes ) ( LLMSpan , error ) {
176+ func (instance * Traceloop ) LogToolCall (ctx context.Context , attrs ToolCallAttributes , workflowAttrs WorkflowAttributes ) LLMSpan {
194177 spanName := fmt .Sprintf ("%s.tool" , attrs .Name )
195178 _ , span := instance .getTracer ().Start (ctx , spanName )
196179
@@ -209,11 +192,11 @@ func (instance *Traceloop) LogToolCall(ctx context.Context, attrs ToolCallAttrib
209192
210193 return LLMSpan {
211194 span : span ,
212- }, nil
195+ }
213196}
214197
215198// LogAgent logs an agent with the specified name
216- func (instance * Traceloop ) LogAgent (ctx context.Context , attrs AgentAttributes , workflowAttrs WorkflowAttributes ) ( LLMSpan , error ) {
199+ func (instance * Traceloop ) LogAgent (ctx context.Context , attrs AgentAttributes , workflowAttrs WorkflowAttributes ) LLMSpan {
217200 spanName := fmt .Sprintf ("%s.agent" , attrs .Name )
218201 _ , span := instance .getTracer ().Start (ctx , spanName )
219202
@@ -232,7 +215,7 @@ func (instance *Traceloop) LogAgent(ctx context.Context, attrs AgentAttributes,
232215
233216 return LLMSpan {
234217 span : span ,
235- }, nil
218+ }
236219}
237220
238221func (instance * Traceloop ) Shutdown (ctx context.Context ) {
0 commit comments