-
Regarding this blogpost: https://ollama.com/blog/structured-outputs Does OllamaSharp support structured outputs yet? |
Beta Was this translation helpful? Give feedback.
Answered by
awaescher
Dec 13, 2024
Replies: 2 comments 2 replies
-
This was implemented by @mili-tan in 4.0.10 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
SamKr
-
In case anyone can't find it, its the 4th parameter to ChatAsync, called "format" and needs to be a json schema object like this: var format = new
{
type = "object",
properties = new
{
computernames = new
{
type = "array",
items = new { type = "string" }
},
ipaddresses = new
{
type = "array",
items = new { type = "string" }
},
users = new
{
type = "array",
items = new { type = "string" }
}
},
required = new[] { "computernames", "users" }
};
await foreach (var answerToken in chat.SendAsync(message, null, null, format))
{
Console.Write(answerToken);
} Does indeed work like a dream! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was implemented by @mili-tan in 4.0.10