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
ConstructorsConstructorDescriptionOpenAiLanguageModel
(String baseUrl, String apiKey, String organizationId, String modelName, Double temperature, Duration timeout, Integer maxRetries, Proxy proxy, Boolean logRequests, Boolean logResponses, dev.langchain4j.model.Tokenizer tokenizer, Map<String, String> customHeaders) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
int
estimateTokenCount
(String prompt) dev.langchain4j.model.output.Response
<String> static OpenAiLanguageModel
withApiKey
(String apiKey) Deprecated.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
Deprecated.usebuilder()
instead and explicitly set the model name and, if required, other parameters. -
builder
-
builder()
instead and explicitly set the model name and, if required, other parameters.