mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-29 06:12:20 +00:00
Merge branch 'main' into add-watsonx-inference-adapter
This commit is contained in:
commit
5366c423ae
10 changed files with 1355 additions and 26 deletions
|
|
@ -6,8 +6,11 @@
|
|||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
from typing import AsyncGenerator, List, Optional, Union
|
||||
|
||||
from termcolor import cprint
|
||||
|
||||
from llama_stack.apis.common.content_types import (
|
||||
TextDelta,
|
||||
ToolCallDelta,
|
||||
|
|
@ -338,6 +341,9 @@ class MetaReferenceInferenceImpl(
|
|||
stop_reason = None
|
||||
|
||||
for token_result in self.generator.chat_completion(request):
|
||||
if os.environ.get("LLAMA_MODELS_DEBUG", "0") == "1":
|
||||
cprint(token_result.text, "cyan", end="")
|
||||
|
||||
tokens.append(token_result.token)
|
||||
|
||||
if token_result.token == tokenizer.eot_id:
|
||||
|
|
@ -386,6 +392,9 @@ class MetaReferenceInferenceImpl(
|
|||
ipython = False
|
||||
|
||||
for token_result in self.generator.chat_completion(request):
|
||||
if os.environ.get("LLAMA_MODELS_DEBUG", "0") == "1":
|
||||
cprint(token_result.text, "cyan", end="")
|
||||
|
||||
tokens.append(token_result.token)
|
||||
|
||||
if not ipython and token_result.text.startswith("<|python_tag|>"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue