feat: remove organization id from trace object in api (#2952)

This commit is contained in:
cthomas
2025-09-16 10:58:11 -07:00
committed by GitHub
parent ed8cd365ed
commit 7eb80ca318
7 changed files with 2 additions and 10 deletions

View File

@@ -106,7 +106,6 @@ class LettaLLMRequestAdapter(LettaLLMAdapter):
request_json=self.request_data,
response_json=self.response_data,
step_id=step_id, # Use original step_id for telemetry
organization_id=actor.organization_id,
),
),
label="create_provider_trace",

View File

@@ -164,7 +164,6 @@ class LettaLLMStreamAdapter(LettaLLMAdapter):
},
},
step_id=step_id, # Use original step_id for telemetry
organization_id=actor.organization_id,
),
),
label="create_provider_trace",

View File

@@ -405,7 +405,6 @@ class LettaAgent(BaseAgent):
request_json=request_data,
response_json=response_data,
step_id=step_id, # Use original step_id for telemetry
organization_id=self.actor.organization_id,
),
)
step_progression = StepProgression.LOGGED_TRACE
@@ -751,7 +750,6 @@ class LettaAgent(BaseAgent):
request_json=request_data,
response_json=response_data,
step_id=step_id, # Use original step_id for telemetry
organization_id=self.actor.organization_id,
),
)
step_progression = StepProgression.LOGGED_TRACE
@@ -1173,7 +1171,6 @@ class LettaAgent(BaseAgent):
},
},
step_id=step_id, # Use original step_id for telemetry
organization_id=self.actor.organization_id,
),
)
step_progression = StepProgression.LOGGED_TRACE

View File

@@ -235,7 +235,6 @@ def create(
request_json=prepare_openai_payload(data),
response_json=response.model_json_schema(),
step_id=step_id,
organization_id=actor.organization_id,
),
)

View File

@@ -64,7 +64,6 @@ class LLMClientBase:
request_json=request_data,
response_json=response_data,
step_id=step_id,
organization_id=self.actor.organization_id,
),
)
log_event(name="llm_response_received", attributes=response_data)
@@ -98,7 +97,6 @@ class LLMClientBase:
request_json=request_data,
response_json=response_data,
step_id=step_id,
organization_id=self.actor.organization_id,
),
)

View File

@@ -19,7 +19,6 @@ class ProviderTraceCreate(BaseModel):
request_json: dict[str, Any] = Field(..., description="JSON content of the provider request")
response_json: dict[str, Any] = Field(..., description="JSON content of the provider response")
step_id: str = Field(None, description="ID of the step that this trace is associated with")
organization_id: str = Field(..., description="The unique identifier of the organization.")
class ProviderTrace(BaseProviderTrace):
@@ -39,5 +38,4 @@ class ProviderTrace(BaseProviderTrace):
request_json: Dict[str, Any] = Field(..., description="JSON content of the provider request")
response_json: Dict[str, Any] = Field(..., description="JSON content of the provider response")
step_id: Optional[str] = Field(None, description="ID of the step that this trace is associated with")
organization_id: str = Field(..., description="The unique identifier of the organization.")
created_at: datetime = Field(default_factory=get_utc_time, description="The timestamp when the object was created.")

View File

@@ -26,6 +26,7 @@ class TelemetryManager:
async def create_provider_trace_async(self, actor: PydanticUser, provider_trace_create: ProviderTraceCreate) -> PydanticProviderTrace:
async with db_registry.async_session() as session:
provider_trace = ProviderTraceModel(**provider_trace_create.model_dump())
provider_trace.organization_id = actor.organization_id
if provider_trace_create.request_json:
request_json_str = json_dumps(provider_trace_create.request_json)
provider_trace.request_json = json_loads(request_json_str)
@@ -43,6 +44,7 @@ class TelemetryManager:
def create_provider_trace(self, actor: PydanticUser, provider_trace_create: ProviderTraceCreate) -> PydanticProviderTrace:
with db_registry.session() as session:
provider_trace = ProviderTraceModel(**provider_trace_create.model_dump())
provider_trace.organization_id = actor.organization_id
if provider_trace_create.request_json:
request_json_str = json_dumps(provider_trace_create.request_json)
provider_trace.request_json = json_loads(request_json_str)