Skip to content

Commit

Permalink
app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavGenAI authored Nov 6, 2024
1 parent 14081ec commit 603340d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ def generate_compare_genAI(extracted_values, values_from_excel, keys_of_interest
"Key2": "No",
...
}} Make sure to return only the JSON, with no other text or explanation.""")

st.write("LLM Response",response.text)
# Ensure response contains candidates and extract the JSON content
if hasattr(response, 'candidates') and len(response.candidates) > 0:
candidate = response.candidates[0] # Access the first candidate

# Debug: Print the entire candidate object to inspect its structure
st.write(candidate) # This will show the structure of the candidate object
st.write("Candidate structure:", candidate) # This will show the structure of the candidate object

# Extract the text from the content
if 'content' in candidate and 'parts' in candidate['content'] and len(candidate['content']['parts']) > 0:
content = candidate['content']['parts'][0].get('text', '').strip()
# Assuming candidate is an object, access the 'content' attribute and parts
if hasattr(candidate, 'content') and hasattr(candidate.content, 'parts') and len(candidate.content.parts) > 0:
content = candidate.content.parts[0].get('text', '').strip()

# Remove the JSON code block markers (```json and ```)
clean_content = content.replace('```json', '').replace('```', '').strip()
Expand Down

0 comments on commit 603340d

Please sign in to comment.