mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 08:58:48 +00:00
community[patch]: Fix unintended newline in print statement in exception for BaichuanTextEmbeddings (#21820)
- **Code:** langchain_community/embeddings/baichuan.py:82 - **Description:** When I make an error using 'baichuan embeddings', the printed error message is wrapped (there is actually no need to wrap) ```python # example from langchain_community.embeddings import BaichuanTextEmbeddings # error key BAICHUAN_API_KEY = "sk-xxxxxxxxxxxxx" embeddings = BaichuanTextEmbeddings(baichuan_api_key=BAICHUAN_API_KEY) text_1 = "今天天气不错" query_result = embeddings.embed_query(text_1) ``` 
This commit is contained in:
parent
aa648298ae
commit
9f8d18c028
@ -80,8 +80,8 @@ class BaichuanTextEmbeddings(BaseModel, Embeddings):
|
|||||||
else:
|
else:
|
||||||
# Log error or handle unsuccessful response appropriately
|
# Log error or handle unsuccessful response appropriately
|
||||||
print( # noqa: T201
|
print( # noqa: T201
|
||||||
f"""Error: Received status code {response.status_code} from
|
f"Error: Received status code {response.status_code} from "
|
||||||
embedding API"""
|
"embedding API"
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user