visible_messages

View as MarkdownOpen in Claude

The transcript a browser may redraw, and nothing else. A static method.

chat_log hands back the conversation as the service holds it: the substituted system prompt first, then tool calls and their results alongside the dialogue. Relaying that verbatim would publish your prompt to anyone holding a handle. Only user and assistant turns with actual text survive, reduced to role, content, and when they were said.

Parameters

messages
list[dict[str, Any]] | NoneRequired

The raw messages, as returned by AIChatClient.log(). None yields an empty list.

Returns

list[dict[str, Any]] — each entry carries role and content. A timestamp is included only when the source message contains a positive integer timestamp.

When included, the timestamp is in epoch seconds, converted from the source value in microseconds.

Example

1from signalwire.ai_chat import AIChatClient, ChatGateway
2
3gateway = ChatGateway(config_url="https://bayview-taxi.example.com/swml")
4
5
6async def transcript(client: AIChatClient, conversation_id: str):
7 conversation = await client.log(conversation_id)
8 return ChatGateway.visible_messages(conversation.messages)
What the browser receives
1[
2 { "role": "assistant", "content": "Bayview Taxi, this is Ada. Where are you headed?", "timestamp": 1786258737.147 },
3 { "role": "user", "content": "The airport, from 123 Gough Street.", "timestamp": 1786258812.004 }
4]