mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-18 08:03:36 +00:00
community: fix Jira API wrapper failing initialization with cloud param (#30117)
### **Description**
Converts the boolean `jira_cloud` parameter in the Jira API Wrapper to a
string before initializing the Jira Client. Also adds tests for the
same.
### **Issue**
[Jira API Wrapper
Bug](8abb65e138/libs/community/langchain_community/utilities/jira.py (L47)
)
```python
jira_cloud_str = get_from_dict_or_env(values, "jira_cloud", "JIRA_CLOUD")
jira_cloud = jira_cloud_str.lower() == "true"
```
The above code has a bug where the value of `"jira_cloud"` is a boolean.
If it is passed, calling `.lower()` on a boolean raises an error.
Additionally, `False` cannot be passed explicitly since
`get_from_dict_or_env` falls back to environment variables.
Relevant code in `langchain_core`:
[Source](https://github.com/thesmallstar/langchain/blob/master/.venv/lib/python3.13/site-packages/langchain_core/utils/env.py#L46)
```python
if isinstance(key, str) and key in data and data[key]: # Here, data[key] is False
```
This PR fixes both issues.
### **Twitter Handle**
[Manthan Surkar](https://x.com/manthan_surkar)
This commit is contained in:
@@ -40,6 +40,9 @@ class JiraAPIWrapper(BaseModel):
|
||||
)
|
||||
values["jira_instance_url"] = jira_instance_url
|
||||
|
||||
if "jira_cloud" in values and values["jira_cloud"] is not None:
|
||||
values["jira_cloud"] = str(values["jira_cloud"])
|
||||
|
||||
jira_cloud_str = get_from_dict_or_env(values, "jira_cloud", "JIRA_CLOUD")
|
||||
jira_cloud = jira_cloud_str.lower() == "true"
|
||||
values["jira_cloud"] = jira_cloud
|
||||
|
Reference in New Issue
Block a user