public class AzureOpenAiStreamingLanguageModel extends Object implements dev.langchain4j.model.language.StreamingLanguageModel, dev.langchain4j.model.language.TokenCountEstimator
StreamingResponseHandler.
However, it's recommended to use OpenAiStreamingChatModel instead,
as it offers more advanced features like function calling, multi-turn conversations, etc.
Mandatory parameters for initialization are: baseUrl, apiVersion and apiKey.
There are two primary authentication methods to access Azure OpenAI:
1. API Key Authentication: For this type of authentication, HTTP requests must include the API Key in the "api-key" HTTP header.
2. Azure Active Directory Authentication: For this type of authentication, HTTP requests must include the authentication/access token in the "Authorization" HTTP header.
Please note, that currently, only API Key authentication is supported by this class, second authentication option will be supported later.
| Modifier and Type | Class and Description |
|---|---|
static class |
AzureOpenAiStreamingLanguageModel.Builder |
| Constructor and Description |
|---|
AzureOpenAiStreamingLanguageModel(String baseUrl,
String apiVersion,
String apiKey,
dev.langchain4j.model.Tokenizer tokenizer,
Double temperature,
Duration timeout,
Proxy proxy,
Boolean logRequests,
Boolean logResponses) |
| Modifier and Type | Method and Description |
|---|---|
static AzureOpenAiStreamingLanguageModel.Builder |
builder() |
int |
estimateTokenCount(String prompt) |
void |
generate(String prompt,
dev.langchain4j.model.StreamingResponseHandler<String> handler) |
public void generate(String prompt, dev.langchain4j.model.StreamingResponseHandler<String> handler)
generate in interface dev.langchain4j.model.language.StreamingLanguageModelpublic int estimateTokenCount(String prompt)
estimateTokenCount in interface dev.langchain4j.model.language.TokenCountEstimatorpublic static AzureOpenAiStreamingLanguageModel.Builder builder()
Copyright © 2023. All rights reserved.