最后活跃于 1731289910

knox 修订了这个 Gist 1731289909. 跳至此修订

1 file changed, 14 insertions

Jina-16.py(file created)

@@ -0,0 +1,14 @@
1 + # Server
2 + with Deployment(uses=TokenStreamingExecutor, port=12345, protocol='grpc') as dep:
3 + dep.block()
4 +
5 +
6 + # Client
7 + async def main():
8 + client = Client(port=12345, protocol='grpc', asyncio=True)
9 + async for doc in client.stream_doc(
10 + on='/stream',
11 + inputs=PromptDocument(prompt='what is the capital of France ?', max_tokens=10),
12 + return_type=ModelOutputDocument,
13 + ):
14 + print(doc.generated_text)
更新 更早