mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 04:04:14 +00:00
add EventLogger for inference
This commit is contained in:
parent
7574ffb25f
commit
bbfd8a587e
2 changed files with 38 additions and 3 deletions
|
@ -13,6 +13,7 @@ from .api import (
|
|||
Inference,
|
||||
UserMessage,
|
||||
)
|
||||
from .event_logger import EventLogger
|
||||
|
||||
|
||||
class InferenceClient(Inference):
|
||||
|
@ -56,14 +57,15 @@ async def run_main(host: str, port: int):
|
|||
messages=[message],
|
||||
stream=True,
|
||||
)
|
||||
async for event in client.chat_completion(
|
||||
iterator = client.chat_completion(
|
||||
ChatCompletionRequest(
|
||||
model=InstructModel.llama3_8b_chat,
|
||||
messages=[message],
|
||||
stream=True,
|
||||
)
|
||||
):
|
||||
print(event)
|
||||
)
|
||||
async for log in EventLogger().log(iterator):
|
||||
log.print()
|
||||
|
||||
|
||||
def main(host: str, port: int):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue