Package dev.langchain4j.model.openai
Class OpenAiLanguageModel
java.lang.Object
dev.langchain4j.model.openai.OpenAiLanguageModel
- All Implemented Interfaces:
dev.langchain4j.model.language.LanguageModel
,dev.langchain4j.model.language.TokenCountEstimator
public class OpenAiLanguageModel
extends Object
implements dev.langchain4j.model.language.LanguageModel, dev.langchain4j.model.language.TokenCountEstimator
Represents an OpenAI language model with a completion interface, such as gpt-3.5-turbo-instruct.
However, it's recommended to use
OpenAiChatModel
instead,
as it offers more advanced features like function calling, multi-turn conversations, etc.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
int
estimateTokenCount
(String prompt) dev.langchain4j.model.output.Response
<String> static OpenAiLanguageModel
withApiKey
(String apiKey) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.langchain4j.model.language.LanguageModel
generate
Methods inherited from interface dev.langchain4j.model.language.TokenCountEstimator
estimateTokenCount, estimateTokenCount
-
Constructor Details
-
OpenAiLanguageModel
-
-
Method Details
-
modelName
-
generate
- Specified by:
generate
in interfacedev.langchain4j.model.language.LanguageModel
-
estimateTokenCount
- Specified by:
estimateTokenCount
in interfacedev.langchain4j.model.language.TokenCountEstimator
-
withApiKey
-
builder
-