DummyLive连接(Connection)

A fake LiveConnection that runs steps in order and records every message sent to it.

Only one receive() may run at a time, a turn-complete response ends the current receive(), and the next receive() resumes at the following step. If the steps run out without DummyLiveStep.EndStream, receive() waits up to 5 seconds for closeSession and then fails the test.

构造函数(Constructors)

Link copied to clipboard
constructor(steps: List<DummyLiveStep>)

创建一个连接;该连接会为每个请求等待最多 5 秒的时间。 DummyLiveStep.AwaitSent 并且为了…… closeSession 一旦所有的步骤都执行完毕……

属性(Properties)

Link copied to clipboard

是否 closeSession 该函数已被调用。

Link copied to clipboard
val sent: List<Any>

所有发送到此连接的消息将按以下顺序显示:a List<Content> from sendHistory, a ContentInput from sendContent,或者一个 RealtimeInput from sendRealtime. 发送那些在之后创建(或生成)的内容。 closeSession 这些数据仍然被记录在系统中。

函数

Link copied to clipboard

抛出异常(或错误) AssertionError 为第一个元素命名…… DummyLiveStep.AwaitSent 那个;那种 receive() 即使后来发送了匹配的消息,也始终无法继续进行后续操作。可以将这种情况视为测试过程中的一个“失败点”:关闭连接意味着所有等待中的操作都会立即终止。 receive() 如果没有其他问题,那么交易很可能会提前结束(即提前达成协议)。

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override fun closeSession()
Link copied to clipboard
open override fun receive(): Flow<LlmResponse>
Link copied to clipboard
open suspend override fun sendContent(content: Content, partial: Boolean)
Link copied to clipboard
open suspend override fun sendHistory(history: List<Content>)
Link copied to clipboard
open suspend override fun sendRealtime(input: RealtimeInput)