# UpTrainCallbackHandler

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/callbacks/uptrain_callback/UpTrainCallbackHandler)

Callback Handler that logs evaluation results to uptrain and the console.

## Signature

```python
UpTrainCallbackHandler(
    self,
    *,
    project_name: str = 'langchain',
    key_type: str = 'openai',
    api_key: str = 'sk-****************',
    model: str = 'gpt-3.5-turbo',
    log_results: bool = True,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_name` | `str` | No | The project name to be shown in UpTrain dashboard. (default: `'langchain'`) |
| `key_type` | `str` | No | Type of key to use. Must be 'uptrain' or 'openai'. (default: `'openai'`) |
| `api_key` | `str` | No | API key for the UpTrain or OpenAI API. (default: `'sk-****************'`) |

## Extends

- `BaseCallbackHandler`

## Constructors

```python
__init__(
    self,
    *,
    project_name: str = 'langchain',
    key_type: str = 'openai',
    api_key: str = 'sk-****************',
    model: str = 'gpt-3.5-turbo',
    log_results: bool = True,
) -> None
```

| Name | Type |
|------|------|
| `project_name` | `str` |
| `key_type` | `str` |
| `api_key` | `str` |
| `model` | `str` |
| `log_results` | `bool` |


## Properties

- `log_results`
- `schema`
- `first_score_printed_flag`
- `uptrain_client`

## Methods

- [`uptrain_evaluate()`](https://reference.langchain.com/python/langchain-community/callbacks/uptrain_callback/UpTrainCallbackHandler/uptrain_evaluate)
- [`on_llm_end()`](https://reference.langchain.com/python/langchain-community/callbacks/uptrain_callback/UpTrainCallbackHandler/on_llm_end)
- [`on_chain_start()`](https://reference.langchain.com/python/langchain-community/callbacks/uptrain_callback/UpTrainCallbackHandler/on_chain_start)
- [`on_retriever_start()`](https://reference.langchain.com/python/langchain-community/callbacks/uptrain_callback/UpTrainCallbackHandler/on_retriever_start)
- [`on_retriever_end()`](https://reference.langchain.com/python/langchain-community/callbacks/uptrain_callback/UpTrainCallbackHandler/on_retriever_end)

---

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