Spaces:
Sleeping
Sleeping
Create model.py
Browse files
model.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain_core.prompts import ChatPromptTemplate
|
| 2 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 3 |
+
|
| 4 |
+
PROMPT_TEMPLATE = """
|
| 5 |
+
Answer the question based only on the following context:
|
| 6 |
+
{context}
|
| 7 |
+
Answer the question based on the above context: {question}.
|
| 8 |
+
Provide a detailed answer.
|
| 9 |
+
Don’t justify your answers.
|
| 10 |
+
Don’t give information not mentioned in the CONTEXT INFORMATION.
|
| 11 |
+
Do not say "according to the context" or "mentioned in the context" or similar.
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
prompt_template = ChatPromptTemplate.from_template(PROMPT_TEMPLATE)
|
| 15 |
+
google_api_key="AIzaSyC9j5KaPVcanw9nvPAfKfORBqsCzBjx37I"
|
| 16 |
+
model=ChatGoogleGenerativeAI(api_key=google_api_key, model="gemini-2.0-flash")
|