MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / chat_stream

Method chat_stream

examples/chatbot/backend/llm_manager.py:60–75  ·  view source on GitHub ↗

Stream chat response tokens from the LLM client. This method provides a streaming interface for chat completions, yielding response tokens as they are generated by the language model. Args: prompt (str): The input prompt to send to the language model.

(self, prompt: str)

Source from the content-addressed store, hash-verified

58 return self.embedding_client.embed_many(texts)
59
60 async def chat_stream(self, prompt: str):
61 """
62 Stream chat response tokens from the LLM client.
63
64 This method provides a streaming interface for chat completions, yielding
65 response tokens as they are generated by the language model.
66
67 Args:
68 prompt (str): The input prompt to send to the language model.
69
70 Yields:
71 str: Individual response tokens from the streaming completion.
72 """
73 response = await self.llm_client.complete_stream(prompt, max_tokens=ConfigConstants.MAX_TOKENS)
74 for chunk in response:
75 yield chunk

Callers 1

stream_full_chatMethod · 0.80

Calls 1

complete_streamMethod · 0.80

Tested by

no test coverage detected