Rom89823974978 commited on
Commit
5754acb
·
1 Parent(s): b4df8a2
backend/main.py CHANGED
@@ -659,10 +659,15 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
659
  model=llm_model,
660
  tokenizer=AutoTokenizer.from_pretrained(settings.llm_model,use_fast= False),
661
  device=-1, # force CPU
662
- max_new_tokens=256,
663
  do_sample=True,
664
  temperature=0.7,
665
- )
 
 
 
 
 
 
666
  # Wrap in LangChain's HuggingFacePipeline
667
  llm = HuggingFacePipeline(pipeline=gen_pipe)
668
 
@@ -693,7 +698,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
693
  "Context (up to 2,000 tokens, with document IDs):\n"
694
  "{context}\n"
695
  "Q: {question}\n"
696
- "A:"
697
  )
698
 
699
  logger.info("Initializing Retrieval Chain")
@@ -820,7 +825,7 @@ def get_projects(
820
  if fundingScheme:
821
  sel = sel.filter(pl.col("_fundingScheme_lc").str.contains(fundingScheme.lower()))
822
  if proj_id:
823
- sel = sel.filter(pl.col("id") == proj_id)
824
 
825
  base_cols = [
826
  "id","title","status","startDate","endDate","ecMaxContribution","acronym",
 
659
  model=llm_model,
660
  tokenizer=AutoTokenizer.from_pretrained(settings.llm_model,use_fast= False),
661
  device=-1, # force CPU
 
662
  do_sample=True,
663
  temperature=0.7,
664
+ max_new_tokens=512,
665
+ do_sample=False,
666
+ num_beams=4,
667
+ early_stopping=True,
668
+ no_repeat_ngram_size=3,
669
+ length_penalty=1.2,
670
+ )
671
  # Wrap in LangChain's HuggingFacePipeline
672
  llm = HuggingFacePipeline(pipeline=gen_pipe)
673
 
 
698
  "Context (up to 2,000 tokens, with document IDs):\n"
699
  "{context}\n"
700
  "Q: {question}\n"
701
+ "A: Please provide a clear, detailed answer in full sentences (at least 3-4 sentences)."
702
  )
703
 
704
  logger.info("Initializing Retrieval Chain")
 
825
  if fundingScheme:
826
  sel = sel.filter(pl.col("_fundingScheme_lc").str.contains(fundingScheme.lower()))
827
  if proj_id:
828
+ sel = sel.filter(pl.col("id") == int(proj_id))
829
 
830
  base_cols = [
831
  "id","title","status","startDate","endDate","ecMaxContribution","acronym",
frontend/src/hooks/useAppState.ts CHANGED
@@ -144,6 +144,7 @@ The output was based on the following Project IDs: ${idList}`;
144
  };
145
 
146
  useEffect(fetchProjects, [page, search, statusFilter,legalFilter, orgFilter, countryFilter, fundingSchemeFilter, idFilter, sortField, sortOrder]);
 
147
  useEffect(() => {
148
  console.log("Updated filters:", filters);
149
  fetchStats(filters);
 
144
  };
145
 
146
  useEffect(fetchProjects, [page, search, statusFilter,legalFilter, orgFilter, countryFilter, fundingSchemeFilter, idFilter, sortField, sortOrder]);
147
+
148
  useEffect(() => {
149
  console.log("Updated filters:", filters);
150
  fetchStats(filters);