@@ -166,16 +166,18 @@ Full example: [examples/offline_inference/vision_language_multi_image.py](../../
...
@@ -166,16 +166,18 @@ Full example: [examples/offline_inference/vision_language_multi_image.py](../../
If using the [LLM.chat](../models/generative_models.md#llmchat) method, you can pass images directly in the message content using various formats: image URLs, PIL Image objects, or pre-computed embeddings:
If using the [LLM.chat](../models/generative_models.md#llmchat) method, you can pass images directly in the message content using various formats: image URLs, PIL Image objects, or pre-computed embeddings:
{"role": "system", "content": "You are a helpful assistant"},
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"},
{"role": "user", "content": "Hello"},
{"role": "assistant", "content": "Hello! How can I assist you today?"},
{"role": "assistant", "content": "Hello! How can I assist you today?"},
...
@@ -200,15 +202,15 @@ conversation = [
...
@@ -200,15 +202,15 @@ conversation = [
},
},
],
],
},
},
]
]
# Perform inference and log output.
# Perform inference and log output.
outputs=llm.chat(conversation)
outputs = llm.chat(conversation)
foroinoutputs:
for o in outputs:
generated_text = o.outputs[0].text
generated_text = o.outputs[0].text
print(generated_text)
print(generated_text)
```
```
Multi-image input can be extended to perform video captioning. We show this with [Qwen2-VL](https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct) as it supports videos:
Multi-image input can be extended to perform video captioning. We show this with [Qwen2-VL](https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct) as it supports videos:
...
@@ -893,6 +895,8 @@ The following example demonstrates how to pass image embeddings to the OpenAI se
...
@@ -893,6 +895,8 @@ The following example demonstrates how to pass image embeddings to the OpenAI se
For Online Serving, you can also skip sending media if you expect cache hits with provided UUIDs. You can do so by sending media like this:
For Online Serving, you can also skip sending media if you expect cache hits with provided UUIDs. You can do so by sending media like this: