All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.langchain4j.model.language.LanguageModel Maven / Gradle / Ivy

package dev.langchain4j.model.language;

import dev.langchain4j.model.input.Prompt;
import dev.langchain4j.model.output.Response;

/**
 * Represents a language model that has a simple text interface (as opposed to a chat interface).
 * It is recommended to use the {@link dev.langchain4j.model.chat.ChatLanguageModel} instead,
 * as it offers more features.
 */
public interface LanguageModel {

    /**
     * Generate a response to the given prompt.
     *
     * @param prompt the prompt.
     * @return the response.
     */
    Response generate(String prompt);

    /**
     * Generate a response to the given prompt.
     *
     * @param prompt the prompt.
     * @return the response.
     */
    default Response generate(Prompt prompt) {
        return generate(prompt.text());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy