Prompt changes
This commit is contained in:
parent
853cae84dc
commit
ea1fc6a430
@ -22,6 +22,7 @@ RUN apt-get update && apt-get install -y \
|
||||
|
||||
# Copy requirements file
|
||||
COPY requirements.txt .
|
||||
COPY ./app/quran_arabic.csv .
|
||||
|
||||
# Create and activate virtual environment
|
||||
RUN python -m venv $VIRTUAL_ENV
|
||||
@ -36,4 +37,4 @@ COPY . .
|
||||
EXPOSE 8000
|
||||
|
||||
# Command to run the application
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
11
app/main.py
11
app/main.py
@ -14,8 +14,11 @@ app = FastAPI()
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=[
|
||||
"https://askalquran.com",
|
||||
"https://www.askalquran.com",
|
||||
"http://localhost:3000",
|
||||
"http://127.0.0.1:3000"
|
||||
"http://127.0.0.1:3000",
|
||||
"http://0.0.0.0:3000"
|
||||
],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
@ -45,11 +48,11 @@ class TafsirRequest(BaseModel):
|
||||
|
||||
# Build LLM prompt
|
||||
def build_arabic_prompt(reference: str, text: str) -> str:
|
||||
return (
|
||||
return (
|
||||
"أنت عالم متخصص في تفسير القرآن الكريم.\n"
|
||||
"يرجى تقديم تفسير شامل ومبسط للآية التالية، مع الأخذ بعين الاعتبار رقم السورة ورقم الآية:\n\n"
|
||||
"يرجى تقديم تفسير مختصر ومبسط للآية التالية:\n\n"
|
||||
f"{reference}\t{text}\n\n"
|
||||
"اكتب التفسير باللغة العربية الفصحى وبأسلوب واضح وميسر للقارئ العام."
|
||||
"اكتب التفسير باللغة العربية الفصحى وبأسلوب مختصر و واضح وميسر للقارئ العام."
|
||||
)
|
||||
|
||||
# Call Groq LLM
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user