Download models/api_model.py from ManTea/TestAPI: direct link, hf CLI and curl.
- Browser
- Download file 612 Bytes
-
https://huggingface.co/spaces/ManTea/TestAPI/resolve/681eb89fc4fc7c6ea866bb0c2216c9274bd5fc23/models/api_model.py
- Command line
-
hf download hf://spaces/ManTea/TestAPI@681eb89fc4fc7c6ea866bb0c2216c9274bd5fc23/models/api_model.py
-
curl -L -o api_model.py https://huggingface.co/spaces/ManTea/TestAPI/resolve/681eb89fc4fc7c6ea866bb0c2216c9274bd5fc23/models/api_model.py
612 Bytes
| import os | |
| import google.generativeai as genai | |
| from langchain_google_genai import ChatGoogleGenerativeAI | |
| from langchain_google_genai import GoogleGenerativeAIEmbeddings | |
| from langchain_google_genai import ChatGoogleGenerativeAI | |
| from langchain_google_genai import GoogleGenerativeAIEmbeddings | |
| #lấy API gemini | |
| os.environ["GOOGLE_API_KEY"] = '' | |
| genai.configure(api_key=os.environ["GOOGLE_API_KEY"]) | |
| #lấy model chatbot | |
| model = ChatGoogleGenerativeAI(model="gemini-pro", | |
| temperature=0.4) | |
| #lấy model embedding | |
| embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001") |