Files
ollama4j/docs/docs/apis-generate/generate.md
Amith Koujalgi 329381b1ee Refactor and reorganize API docs structure
Moved and renamed several API documentation files for better organization, updated sidebar positions, and merged image generation docs. Added logging documentation and updated Makefile commands for docs build and serve. Improved clarity and consistency in API doc titles and structure.
2025-09-17 10:34:50 +05:30

2.1 KiB

sidebar_position
sidebar_position
2

import CodeEmbed from '@site/src/components/CodeEmbed'; import TypewriterTextarea from '@site/src/components/TypewriterTextarea';

Generate

This API lets you ask questions to the LLMs in a synchronous way. This API corresponds to the completion API.

Use the OptionBuilder to build the Options object with extra parameters. Refer to this.

Try asking a question about the model

You will get a response similar to:

::::tip[LLM Response] I am a model of an AI trained by Mistral AI. I was designed to assist with a wide range of tasks, from answering questions to helping with complex computations and research. How can I help you toda ::::

Try asking a question, receiving the answer streamed

You will get a response similar to:

Generate structured output

With response as a Map

You will get a response similar to:

::::tip[LLM Response]

{
  "heroName" : "Batman",
  "ageOfPerson" : 30
}

::::

With response mapped to specified class type

::::tip[LLM Response] HeroInfo(heroName=Batman, ageOfPerson=30) ::::