Bhanumani12 commited on
Commit
1e89d3d
·
verified ·
1 Parent(s): ce6e170

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -23,20 +23,19 @@ def validate_metadata(metadata):
23
  return "Field", "Unused field detected", "Remove it to improve performance"
24
 
25
  # --------------------------
26
- # AI Natural Language Q&A (No Fallback)
27
  # --------------------------
28
  def process_nlp_query(query):
29
  if not query.strip():
30
  return "No query provided."
31
 
32
- prompt = f"""
33
- You are a Salesforce and Apex expert. Provide a clear and technically accurate answer to the following question:\n\n{query}\n\nAnswer:
34
- """
35
  result = nlp_model(
36
  prompt,
37
  max_length=256,
38
  temperature=0.7,
39
- top_k=40,
40
  top_p=0.9,
41
  repetition_penalty=1.3,
42
  do_sample=True
@@ -47,7 +46,6 @@ def process_nlp_query(query):
47
  if "Answer:" in output:
48
  output = output.split("Answer:")[-1]
49
 
50
- # Clean response (remove duplicates, spacing)
51
  lines = output.strip().splitlines()
52
  seen = set()
53
  unique_lines = [line.strip() for line in lines if line.strip() not in seen and not seen.add(line.strip())]
 
23
  return "Field", "Unused field detected", "Remove it to improve performance"
24
 
25
  # --------------------------
26
+ # AI Q&A Generator (No fallback)
27
  # --------------------------
28
  def process_nlp_query(query):
29
  if not query.strip():
30
  return "No query provided."
31
 
32
+ prompt = f"""You are a certified Salesforce Apex expert. Answer this question clearly and accurately:\n\nQuestion: {query}\n\nAnswer:"""
33
+
 
34
  result = nlp_model(
35
  prompt,
36
  max_length=256,
37
  temperature=0.7,
38
+ top_k=50,
39
  top_p=0.9,
40
  repetition_penalty=1.3,
41
  do_sample=True
 
46
  if "Answer:" in output:
47
  output = output.split("Answer:")[-1]
48
 
 
49
  lines = output.strip().splitlines()
50
  seen = set()
51
  unique_lines = [line.strip() for line in lines if line.strip() not in seen and not seen.add(line.strip())]