You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/community/langchain_community/utils/user_agent.py

17 lines
437 B
Python

import logging
import os
log = logging.getLogger(__name__)
def get_user_agent() -> str:
"""Get user agent from environment variable."""
env_user_agent = os.environ.get("USER_AGENT")
if not env_user_agent:
log.warning(
"USER_AGENT environment variable not set, "
"consider setting it to identify your requests."
)
return "DefaultLangchainUserAgent"
return env_user_agent