Download llm.py from ESkuratov/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 622 Bytes
-
https://huggingface.co/spaces/ESkuratov/Final_Assignment_Template/resolve/main/llm.py
- Command line
-
hf download hf://spaces/ESkuratov/Final_Assignment_Template/llm.py
-
curl -L -o llm.py https://huggingface.co/spaces/ESkuratov/Final_Assignment_Template/resolve/main/llm.py
622 Bytes
| import os | |
| from dotenv import load_dotenv | |
| from logger import logger | |
| from langchain_openai import ChatOpenAI | |
| # Set up the language model for the GAIA agent | |
| # This model is used both for planning and for the LLM tool itself | |
| load_dotenv() | |
| api_key = os.getenv("OPENAI_API_KEY") | |
| if not api_key: | |
| logger.warning("OPENAI_API_KEY is not set") | |
| base_url = os.getenv("BASE_URL") | |
| if not base_url: | |
| logger.warning("BASE_URL is not set") | |
| model = ChatOpenAI( | |
| model="anthropic/claude-3.7-sonnet", | |
| temperature=0, | |
| max_tokens=None, | |
| timeout=None, | |
| max_retries=2, | |
| api_key = api_key, | |
| base_url = base_url) |