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()intestimateTokenCount(String prompt) dev.langchain4j.model.output.Response<String> static OpenAiLanguageModelwithApiKey(String apiKey) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.model.language.LanguageModel
generateMethods inherited from interface dev.langchain4j.model.language.TokenCountEstimator
estimateTokenCount, estimateTokenCount
-
Constructor Details
-
OpenAiLanguageModel
-
-
Method Details
-
modelName
-
generate
- Specified by:
generatein interfacedev.langchain4j.model.language.LanguageModel
-
estimateTokenCount
- Specified by:
estimateTokenCountin interfacedev.langchain4j.model.language.TokenCountEstimator
-
withApiKey
Deprecated, for removal: This API element is subject to removal in a future version.Please usebuilder()instead, and explicitly set the model name and, if necessary, other parameters. The default values for the model name and temperature will be removed in future releases! -
builder
-
builder()instead, and explicitly set the model name and, if necessary, other parameters.