# get_from_env

> **Function** in `langchain_core`

📖 [View in docs](https://reference.langchain.com/python/langchain-core/utils/env/get_from_env)

Get a value from a dictionary or an environment variable.

## Signature

```python
get_from_env(
    key: str,
    env_key: str,
    default: str | None = None,
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `key` | `str` | Yes | The key to look up in the dictionary. |
| `env_key` | `str` | Yes | The environment variable to look up if the key is not in the dictionary. |
| `default` | `str \| None` | No | The default value to return if the key is not in the dictionary or the environment. (default: `None`) |

## Returns

`str`

The value of the key.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/ee95ad6907f5eab94644183393a20aa2a032bb19/libs/core/langchain_core/utils/env.py#L60)