Skip to content

Commit

Permalink
Change multiline comment width
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt committed Aug 29, 2023
1 parent 7979cef commit e71f476
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions libs/langchain/langchain/callbacks/llmonitor_callback.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import traceback
from datetime import datetime
from typing import Any, Dict, List, Literal, Optional, Union
from typing import Any, Dict, List, Literal, Union
from uuid import UUID

import requests
Expand Down Expand Up @@ -36,11 +36,15 @@ def _serialize_lc_message(message: BaseMessage) -> Dict[str, Any]:
class LLMonitorCallbackHandler(BaseCallbackHandler):
"""Initializes the `LLMonitorCallbackHandler`.
#### Parameters:
- `app_id`: The app id of the app you want to report to. Defaults to `None`, which means that `LLMONITOR_APP_ID` will be used.
- `api_url`: The url of the LLMonitor API. Defaults to `None`, which means that either `LLMONITOR_API_URL` environment variable or `https://app.llmonitor.com` will be used.
- `app_id`: The app id of the app you want to report to. Defaults to
`None`, which means that `LLMONITOR_APP_ID` will be used.
- `api_url`: The url of the LLMonitor API. Defaults to `None`,
which means that either `LLMONITOR_API_URL` environment variable
or `https://app.llmonitor.com` will be used.
#### Raises:
- `ValueError`: if `app_id` is not provided either as an argument or as an environment variable.
- `ValueError`: if `app_id` is not provided either as an
argument or as an environment variable.
- `ConnectionError`: if the connection to the API fails.
Expand All @@ -50,7 +54,8 @@ class LLMonitorCallbackHandler(BaseCallbackHandler):
from langchain.callbacks import LLMonitorCallbackHandler
llmonitor_callback = LLMonitorCallbackHandler()
llm = OpenAI(callbacks=[llmonitor_callback], metadata={"userId": "user-123"})
llm = OpenAI(callbacks=[llmonitor_callback],
metadata={"userId": "user-123"})
llm.predict("Hello, how are you?")
```
"""
Expand All @@ -68,7 +73,8 @@ def __init__(
_app_id = app_id or os.getenv("LLMONITOR_APP_ID")
if _app_id is None:
raise ValueError(
"app_id must be provided either as an argument or as an environment variable"
"""app_id must be provided either as an argument or as
an environment variable"""
)
self.__app_id = _app_id

Expand Down

0 comments on commit e71f476

Please sign in to comment.