forked from phoenix-oss/llama-stack-mirror
Enable vision models for (Together, Fireworks, Meta-Reference, Ollama) (#376)
* Enable vision models for Together and Fireworks * Works with ollama 0.4.0 pre-release with the vision model * localize media for meta_reference inference * Fix
This commit is contained in:
parent
db30809141
commit
cde9bc1388
11 changed files with 465 additions and 81 deletions
|
@ -46,6 +46,9 @@ def text_from_choice(choice) -> str:
|
|||
if hasattr(choice, "delta") and choice.delta:
|
||||
return choice.delta.content
|
||||
|
||||
if hasattr(choice, "message"):
|
||||
return choice.message.content
|
||||
|
||||
return choice.text
|
||||
|
||||
|
||||
|
@ -99,7 +102,6 @@ def process_chat_completion_response(
|
|||
async def process_completion_stream_response(
|
||||
stream: AsyncGenerator[OpenAICompatCompletionResponse, None], formatter: ChatFormat
|
||||
) -> AsyncGenerator:
|
||||
|
||||
stop_reason = None
|
||||
|
||||
async for chunk in stream:
|
||||
|
@ -158,6 +160,10 @@ async def process_chat_completion_stream_response(
|
|||
break
|
||||
|
||||
text = text_from_choice(choice)
|
||||
if not text:
|
||||
# Sometimes you get empty chunks from providers
|
||||
continue
|
||||
|
||||
# check if its a tool call ( aka starts with <|python_tag|> )
|
||||
if not ipython and text.startswith("<|python_tag|>"):
|
||||
ipython = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue