I am trying to put text in a report I am trying to create. The text data is of type json object. I have a list of paths that iterates through and then I load the json object and then grab the text, and do some parsing. The problem is that the final result does not look good.
Here is what the JSON object looks like:
<s> <|im_start|> system
You are Orca, an AI language model created by Microsoft. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. <|im_end|>
<|im_start|> user
Please provide an real estate investment summary for Branch County, MI. Include the pros and cons of investing there assuming we are going to hold the property for at least 5 years or more. Lastly, include an overall investment thesis. <|im_end|>
<|im_start|> assistant
A possible real estate investment summary for Branch County, MI is:
Branch County is a rural county in southwestern Michigan, with a population of about 45,000. The county seat is Coldwater, which is also the largest city in the county. The county has a diverse economy, with agriculture, manufacturing, health care, and education as the main sectors. The county is also home to several state parks, lakes, and recreational trails.
Pros of investing in Branch County, MI:
- Low property taxes and affordable housing prices, compared to the state and national averages.
- High rental demand and low vacancy rates, due to the lack of new construction and the presence of several colleges and universities in the county.
- Potential for appreciation and cash flow, as the county has a stable and growing population, a low unemployment rate, and a strong school system.
- Opportunity to diversify your portfolio and hedge against inflation, by investing in different types of properties, such as single-family homes, multi-family buildings, mobile homes, and land.
Cons of investing in Branch County, MI:
- Limited access to public transportation and major highways, which may affect the mobility and convenience of tenants and owners.
- High crime rates and low quality of education in some areas, which may deter some potential renters and buyers.
- Weather-related risks, such as harsh winters, floods, and tornadoes, which may require additional maintenance and insurance costs.
- Lack of economic and demographic diversity, which may limit the future growth and demand for real estate in the county.
Overall investment thesis:
Branch County, MI is a viable option for real estate investors who are looking for a long-term, passive, and income-generating strategy. The county offers a combination of low-cost, high-demand, and appreciating properties, with a relatively low risk of market fluctuations and downturns. However, investors should also be aware of the potential drawbacks and challenges of investing in a rural and homogeneous market, and be prepared to deal with the environmental and social issues that may arise. Investors should also conduct thorough due diligence and research on the specific locations, neighborhoods, and properties that they are interested in, and seek professional advice and guidance as needed.</s>
This is what the parsed text of this json object looks like:
:nnBranch County is a rural county in southwestern Michigan, with a population of about 45,000. The county seat is Coldwater, which is also the largest city in the county. The county has a diverse economy, with agriculture, manufacturing, health care, and education as the main sectors. The county is also home to several state parks, lakes, and recreational trails.nnPros of investing in Branch County, MI:nn- Low property taxes and affordable housing prices, compared to the state and national averages.n- High rental demand and low vacancy rates, due to the lack of new construction and the presence of several colleges and universities in the county.n- Potential for appreciation and cash flow, as the county has a stable and growing population, a low unemployment rate, and a strong school system.n- Opportunity to diversify your portfolio and hedge against inflation, by investing in different types of properties, such as single-family homes, multi-family buildings, mobile homes, and land.nnCons of investing in Branch County, MI:nn- Limited access to public transportation and major highways, which may affect the mobility and convenience of tenants and owners.n- High crime rates and low quality of education in some areas, which may deter some potential renters and buyers.n- Weather-related risks, such as harsh winters, floods, and tornadoes, which may require additional maintenance and insurance costs.n- Lack of economic and demographic diversity, which may limit the future growth and demand for real estate in the county.nnOverall investment thesis:nnBranch County, MI is a viable option for real estate investors who are looking for a long-term, passive, and income-generating strategy. The county offers a combination of low-cost, high-demand, and appreciating properties, with a relatively low risk of market fluctuations and downturns. However, investors should also be aware of the potential drawbacks and challenges of investing in a rural and homogeneous market, and be prepared to deal with the environmental and social issues that may arise. Investors should also conduct thorough due diligence and research on the specific locations, neighborhoods, and properties that they are interested in, and seek professional advice and guidance as needed.</s>"
This is what the pdf looks like
[![enter image description here][1]][1]
Here is the code I am using that generates that pdf
def create_report(county_and_state, llm_text, analytics_location_path=None):
pdf = FPDF()
pdf.add_page()
pdf.set_text_color(r=50,g=108,b=175)
pdf.set_font('Arial', 'B', 18)
pdf.cell(w=0, h=10, txt="Verus-AI: " + county_and_state, ln=1,align='C')
pdf.set_font('Arial', 'B', 16)
pdf.cell(w=0, h=10, txt="Investment Summary", ln=1,align='L')
pdf.set_text_color(r=0,g=0,b=0)
pdf.set_font('Arial', '', 6)
pdf.multi_cell(w=0, h=10, txt=llm_text,align='L')
pdf.set_text_color(r=50,g=108,b=175)
pdf.set_font('Arial', 'B', 16)
pdf.cell(w=0, h=10, txt="Analytics", ln=1,align='L')
pdf.output(f'./example1.pdf', 'F')
Any suggestions are greatly appreciated.
[1]: https://i.sstatic.net/HlFk4abO.png