This commit is contained in:
Erick Friis
2024-02-04 17:29:24 -08:00
parent 0903f1d3e0
commit 5964630e7b
3 changed files with 6 additions and 9 deletions

View File

@@ -144,7 +144,10 @@ class AzureChatOpenAI(ChatOpenAI):
values, "openai_api_type", "OPENAI_API_TYPE", default="azure"
)
values["openai_proxy"] = get_from_dict_or_env( # type: ignore
values, "openai_proxy", "OPENAI_PROXY", default="" # type: ignore
values,
"openai_proxy",
"OPENAI_PROXY",
default="", # type: ignore
)
try:

View File

@@ -268,9 +268,7 @@ class LocalAIEmbeddings(BaseModel, Embeddings):
self,
input=[text],
**self._invocation_params,
)["data"][
0
]["embedding"]
)["data"][0]["embedding"]
async def _aembedding_func(self, text: str, *, engine: str) -> List[float]:
"""Call out to LocalAI's embedding endpoint."""

View File

@@ -106,11 +106,7 @@ def test_azure_openai_embedding_with_empty_string() -> None:
assert len(output[0]) == 1536
expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[ # type: ignore
"data"
][
0
][
"embedding"
]
][0]["embedding"]
assert np.allclose(output[0], expected_output)
assert len(output[1]) == 1536