# Beam

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/llms/beam/Beam)

Beam API for gpt2 large language model.

To use, you should have the ``beam-sdk`` python package installed,
and the environment variable ``BEAM_CLIENT_ID`` set with your client id
and ``BEAM_CLIENT_SECRET`` set with your client secret. Information on how
to get this is available here: https://docs.beam.cloud/account/api-keys.

The wrapper can then be called as follows, where the name, cpu, memory, gpu,
python version, and python packages can be updated accordingly. Once deployed,
the instance can be called.

## Signature

```python
Beam()
```

## Description

**Example:**

.. code-block:: python

llm = Beam(model_name="gpt2",
    name="langchain-gpt2",
    cpu=8,
    memory="32Gi",
    gpu="A10G",
    python_version="python3.8",
    python_packages=[
        "diffusers[torch]>=0.10",
        "transformers",
        "torch",
        "pillow",
        "accelerate",
        "safetensors",
        "xformers",],
    max_length=50)
llm._deploy()
call_result = llm._call(input)

## Extends

- `LLM`

## Properties

- `model_name`
- `name`
- `cpu`
- `memory`
- `gpu`
- `python_version`
- `python_packages`
- `max_length`
- `url`
- `model_kwargs`
- `beam_client_id`
- `beam_client_secret`
- `app_id`
- `model_config`
- `authorization`

## Methods

- [`build_extra()`](https://reference.langchain.com/python/langchain-community/llms/beam/Beam/build_extra)
- [`validate_environment()`](https://reference.langchain.com/python/langchain-community/llms/beam/Beam/validate_environment)
- [`app_creation()`](https://reference.langchain.com/python/langchain-community/llms/beam/Beam/app_creation)
- [`run_creation()`](https://reference.langchain.com/python/langchain-community/llms/beam/Beam/run_creation)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/llms/beam.py#L22)