mirror of
https://github.com/hwchase17/langchain.git
synced 2026-04-23 20:23:59 +00:00
fmt
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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."""
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user