Spaces:
Sleeping
Sleeping
File size: 922 Bytes
b338bed 1b0bdb5 b338bed 1b0bdb5 b338bed 1b0bdb5 b338bed 1b0bdb5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
from pydantic import BaseModel, Field
from typing import List, Dict, Any
class TextStreamResponse(BaseModel):
streamed_chunks: List[str] = Field(
default_factory=list, description="List of streamed chunks."
)
streamed_chunks_timings: List[float] = Field(
default_factory=list, description="List of streamed chunks timings, in seconds."
)
uid: int = Field(0, description="UID of queried miner")
completion: str = Field(
"", description="The final completed string from the stream."
)
timing: float = Field(
0, description="Timing information of all request, in seconds."
)
def to_dict(self):
return {
"streamed_chunks": self.streamed_chunks,
"streamed_chunks_timings": self.streamed_chunks_timings,
"uid": self.uid,
"completion": self.completion,
"timing": self.timing,
}
|