V0.8.0 #49
+27
-13
@@ -20,19 +20,33 @@ mutable struct yiemAgent <: agent # High-level agent wrapper
|
|||||||
# user sends prompt message to agent. if agent is idle, it process user message right away.
|
# user sends prompt message to agent. if agent is idle, it process user message right away.
|
||||||
# if agent is running, it process user message after the current tool call finished.
|
# if agent is running, it process user message after the current tool call finished.
|
||||||
# Expect each message in OpenAI chat format:
|
# Expect each message in OpenAI chat format:
|
||||||
# Dict("role" => "user", "content" => [
|
# image1_path = "test/large_image.png"
|
||||||
# Dict("type" => "text", "text" => "Your question here"),
|
# image1_bytes = read(image1_path)
|
||||||
# Dict("type" => "image_url", "image_url" => Dict("url" => "data:image/png;base64,<base64-string>"))
|
# image1_base64_string = base64encode(image1_bytes)
|
||||||
# ])
|
# mime_type = "image/png"
|
||||||
# To embed an image, read it as bytes and encode to base64:
|
# data1_uri = "data:$(mime_type);base64,$(image1_base64_string)"
|
||||||
# img = read("path/to/image.png")
|
|
||||||
# b64 = base64encode(img)
|
# # 1. Read local file and encode to base64 string
|
||||||
# data_uri = "data:image/png;base64,$b64"
|
# image2_path = "test/small_image.png"
|
||||||
# message = Dict("role" => "user", "content" => [
|
# image2_bytes = read(image2_path)
|
||||||
# Dict("type" => "text", "text" => "Do you have this wine?"),
|
# image2_base64_string = base64encode(image2_bytes)
|
||||||
# Dict("type" => "image_url", "image_url" => Dict("url" => data_uri))
|
# mime_type = "image/png"
|
||||||
# ])
|
# data2_uri = "data:$(mime_type);base64,$(image2_base64_string)"
|
||||||
# Multiple images can be included alongside text in the content array.
|
|
||||||
|
# # 3. Construct payload with the Data URI
|
||||||
|
# message = Dict(
|
||||||
|
# "role" => "user",
|
||||||
|
# "content" => [
|
||||||
|
# Dict("type" => "text", "text" =>
|
||||||
|
# "
|
||||||
|
# Do you have Brunello di Montalcino from Tenuta CastelGiocon?
|
||||||
|
# "),
|
||||||
|
# Dict(
|
||||||
|
# "type" => "image_url",
|
||||||
|
# "image_url" => Dict("url" => data1_uri)
|
||||||
|
# )
|
||||||
|
# ]
|
||||||
|
# )
|
||||||
inputChannel::Channel
|
inputChannel::Channel
|
||||||
|
|
||||||
# Buffers follow-up messages the user sends while the agent is busy. Uses the same
|
# Buffers follow-up messages the user sends while the agent is busy. Uses the same
|
||||||
|
|||||||
Reference in New Issue
Block a user