Initial support for Azure LLM nodes.
There are still some rough edges due to underlying langchain and openai API limitations, e.g. hwchase17/langchain#3769 and openai/openai-python#411. Notably, you can't use the Azure and non-Azure node types in the same server, since there's global openai configuration needed to choose between the two. So it's probably best to still leave the Azure node types commented out in the default config. But with this PR, if you uncomment those nodes and start the server with OPENAI_API_TYPE=azure, you will have working Azure nodes.
This commit is contained in:
parent
eeee895f6a
commit
5b28bbb795
4 changed files with 98 additions and 2 deletions
|
|
@ -482,3 +482,77 @@ def test_chat_open_ai(client: TestClient):
|
|||
"ChatOpenAI",
|
||||
"BaseLanguageModel",
|
||||
}
|
||||
|
||||
|
||||
def test_azure_open_ai(client: TestClient):
|
||||
response = client.get("/all")
|
||||
assert response.status_code == 200
|
||||
json_response = response.json()
|
||||
language_models = json_response["llms"]
|
||||
|
||||
model = language_models["AzureOpenAI"]
|
||||
template = model["template"]
|
||||
|
||||
assert template["model_name"].show is False
|
||||
assert template["deployment_name"] == {
|
||||
"required": False,
|
||||
"placeholder": "",
|
||||
"show": True,
|
||||
"multiline": False,
|
||||
"value": "",
|
||||
"password": False,
|
||||
"name": "deployment_name",
|
||||
"advanced": False,
|
||||
"type": "str",
|
||||
"list": False,
|
||||
}
|
||||
|
||||
|
||||
def test_azure_chat_open_ai(client: TestClient):
|
||||
response = client.get("/all")
|
||||
assert response.status_code == 200
|
||||
json_response = response.json()
|
||||
language_models = json_response["llms"]
|
||||
|
||||
model = language_models["AzureChatOpenAI"]
|
||||
template = model["template"]
|
||||
|
||||
assert template["model_name"].show is False
|
||||
assert template["deployment_name"] == {
|
||||
"required": False,
|
||||
"placeholder": "",
|
||||
"show": True,
|
||||
"multiline": False,
|
||||
"value": "",
|
||||
"password": False,
|
||||
"name": "deployment_name",
|
||||
"advanced": False,
|
||||
"type": "str",
|
||||
"list": False,
|
||||
}
|
||||
assert template["openai_api_type"] == {
|
||||
"required": False,
|
||||
"placeholder": "",
|
||||
"show": False,
|
||||
"multiline": False,
|
||||
"value": "azure",
|
||||
"password": False,
|
||||
"name": "openai_api_type",
|
||||
"display_name": "OpenAI API Type",
|
||||
"advanced": False,
|
||||
"type": "str",
|
||||
"list": False,
|
||||
}
|
||||
assert template["openai_api_version"] == {
|
||||
"required": False,
|
||||
"placeholder": "",
|
||||
"show": True,
|
||||
"multiline": False,
|
||||
"value": "2023-03-15-preview",
|
||||
"password": False,
|
||||
"name": "openai_api_version",
|
||||
"display_name": "OpenAI API Version",
|
||||
"advanced": False,
|
||||
"type": "str",
|
||||
"list": False,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue