Save LLM event data to ClickHouse.
(data: dict)
| 68 | |
| 69 | |
| 70 | async def create_llm_event(data: dict) -> None: |
| 71 | """Save LLM event data to ClickHouse.""" |
| 72 | assert 'session_id' in data, 'session_id must be provided to create LLM event data.' |
| 73 | assert 'agent_id' in data, 'agent_id must be provided to create LLM event data.' |
| 74 | project_id = await _get_project_id(data['session_id']) |
| 75 | |
| 76 | llm_event = LLMEvent(**data) |
| 77 | span: Span = await llm_event.to_span( |
| 78 | trace_id=str(data['session_id']), parent_span_id=str(data['agent_id']), project_id=str(project_id) |
| 79 | ) |
| 80 | await clickhouse_create_span(span) |
| 81 | logger.info(f"Created ClickHouse LLM event as span {span}") |
| 82 | |
| 83 | |
| 84 | async def update_llm_event(data: dict) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…