Spaces:
Sleeping
Sleeping
Download src/services/llm_client.py from Subhajit01/SmartLead: direct link, hf CLI and curl.
- Browser
- Download file 505 Bytes
-
https://huggingface.co/spaces/Subhajit01/SmartLead/resolve/main/src/services/llm_client.py
- Command line
-
hf download hf://spaces/Subhajit01/SmartLead/src/services/llm_client.py
-
curl -L -o llm_client.py https://huggingface.co/spaces/Subhajit01/SmartLead/resolve/main/src/services/llm_client.py
505 Bytes
| from langchain_google_genai import ChatGoogleGenerativeAI | |
| from langchain.chains import LLMChain | |
| from dotenv import load_dotenv | |
| import os | |
| load_dotenv() | |
| class LLMClient: | |
| def __init__(self): | |
| self.client = ChatGoogleGenerativeAI(model="gemini-2.5-flash", google_api_key = os.getenv('GOOGLE_API_KEY')) | |
| # self.client.invoke() | |
| async def generate_text(self, prompt: str) -> str: | |
| response = await self.client.invoke([prompt]).generations[0][0].text | |
| return response |