Spaces:
Sleeping
Sleeping
| import os | |
| from dotenv import load_dotenv | |
| # Secret Key | |
| load_dotenv(override=True) | |
| tavily_api_key = os.getenv("TAVILY_API_KEY") | |
| def blog_content_agent(llm, state): | |
| from langgraph.graph import MessagesState | |
| from langchain_community.tools import DuckDuckGoSearchRun | |
| from langchain_community.tools import TavilySearchResults | |
| from langchain_core.messages import HumanMessage, SystemMessage | |
| from datetime import date | |
| topic = state["final_topic"] | |
| print(topic) | |
| # tool | |
| def tavily_search(query: str) -> str: | |
| """ | |
| Performs a search on Tavily using the provided query. | |
| Args: | |
| query (str): The search query to be executed. | |
| Returns: | |
| str: The result of the search query. | |
| """ | |
| current_year = date.today().strftime("%Y") | |
| tavily = TavilySearchResults( | |
| max_results=5, | |
| search_depth="advanced", | |
| include_answer=True, | |
| include_raw_content=True, | |
| api_key=tavily_api_key, # type: ignore | |
| ) | |
| text = tavily.invoke({"query": f"Search this in UK: {query} After: {current_year}"}) | |
| print("Tool Call") | |
| print(text) | |
| return text | |
| tool = [tavily_search] | |
| # llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash-exp", api_key = gemini_api_key) | |
| llm_with_tools = llm.bind_tools(tool) | |
| # System message | |
| sys_msg = SystemMessage(content=""" | |
| Task: You are an expert Blog post generator. Generate a blog post on the topic given to you by using the examples below as a guide. | |
| Examples: | |
| Example 1: | |
| # Is It Time To Replace Your Boiler? | |
| A boiler is the heart of your home’s heating system, working tirelessly behind the scenes to provide hot water and warmth. Often taken for granted, it operates quietly and efficiently—until something goes wrong. Like any appliance, boilers have a limited lifespan and will eventually show signs of wear and tear. Neglecting these warning signs can lead to higher energy bills, costly repairs, and even unexpected breakdowns, leaving you without heat or hot water when you need it most. | |
| Recognising when to replace your boiler is crucial to maintaining a safe, efficient, and comfortable home. By upgrading to a modern, energy-efficient model, you can enjoy lower energy costs, better performance, and peace of mind. In this guide, we’ll highlight the key indicators that it might be time to retire your old boiler and invest in a replacement. | |
| ## 1. Your Boiler is Over 10-15 Years Old | |
| The typical lifespan of a boiler is around 10-15 years, depending on the make, model, and maintenance history. Older boilers are often less efficient, costing more to run and repair. Even if your boiler appears to be functioning, upgrading to a modern, energy-efficient model is worth considering. Newer boilers are typically A-rated for efficiency and can save you a significant amount on your energy bills over time. | |
| ## 2. Frequent Breakdowns and Repairs | |
| Regular breakdowns are a clear sign that your boiler is nearing the end of its life. While occasional repairs are to be expected, frequent callouts can quickly become expensive. If you find yourself repeatedly fixing the same issues or spending more than half the cost of a new boiler on repairs, it’s time to invest in a replacement. | |
| ## 3. Increasing Energy Bills | |
| If your energy bills are creeping up despite consistent usage, your boiler might be losing efficiency. As boilers age, their components wear out, making them work harder to produce the same amount of heat. This inefficiency not only affects your wallet but also increases your carbon footprint. | |
| ## 4. Strange Noises | |
| While no boiler is entirely silent, unusual sounds like banging, whistling, or gurgling could indicate a serious problem. These noises may be caused by internal components wearing out, sediment build-up, or even air in the system. Although some of these issues can be repaired, persistent noises are often a sign that your boiler is on its last legs. | |
| ## 5. Uneven Heating in Your Home | |
| If some rooms in your house feel colder than others, it might be a sign that your boiler is struggling to distribute heat effectively. Poor performance can be caused by wear and tear, blockages, or an inability to meet your home’s heating demands. A new boiler can resolve these issues, ensuring consistent warmth throughout your home. | |
| ## 6. Yellow Flame or Pilot Light Issues | |
| A healthy boiler flame should burn bright blue. If you notice a yellow or orange flame, it could indicate incomplete combustion, which may lead to carbon monoxide production. Carbon monoxide is a highly dangerous gas that’s odourless and colourless. If your boiler’s pilot light frequently goes out or the flame changes colour, seek professional help immediately and consider a replacement. | |
| ## 7. Leaks and Corrosion | |
| Water leaks around your boiler or visible signs of corrosion are clear indicators of serious issues. Leaks can damage other components, lead to inefficiency, and even cause structural damage to your home. While small leaks might be repairable, widespread corrosion often means your boiler needs to be replaced. | |
| ## 8. Outdated Technology | |
| Older boilers lack the modern technology found in newer models, such as smart controls, weather compensation, and energy monitoring. These features not only improve convenience but also help optimise efficiency and reduce running costs. If your boiler doesn’t support these advancements, upgrading could be a wise decision. | |
| ## 9. Failing to Meet Your Heating and Hot Water Needs | |
| If your boiler takes longer to heat up, struggles to provide enough hot water, or fails to keep your home warm, it’s time to consider a replacement. Boilers that can no longer cope with your household’s demands are not only inconvenient but also inefficient. | |
| ## Key Signs You Need a New Boiler | |
| Replacing your boiler might seem like a significant investment, but it can save you money and provide peace of mind in the long run. An energy-efficient boiler reduces your heating costs, lowers your carbon footprint, and ensures reliable performance. If you recognise any of the signs above, it’s worth consulting a professional heating engineer to discuss your options. Don’t wait for a complete breakdown—a proactive approach can prevent inconvenience and additional costs during the colder months. The team at South Coast Plumbing and Heating will give you an honest opinion about replacing your boiler - contact us today. | |
| Example 2: | |
| # When Is the Right Time to Replace Your Boiler? | |
| Your boiler is one of the most important appliances in your home, providing hot water and central heating throughout the year. However, like any other household system, boilers don’t last forever. Knowing when to replace your boiler can save you from unexpected breakdowns, costly repairs, and inefficient energy use. In this guide, we’ll explore the key signs that indicate it might be time for an upgrade. | |
| ## How Long Does a Boiler Last? | |
| Most boilers have a lifespan of around 10 to 15 years, depending on the make, model, and how well they’ve been maintained. If your boiler is reaching or exceeding this age, it’s worth considering a replacement, even if it appears to be functioning normally. Older boilers tend to be less efficient, leading to higher energy bills, and they are more prone to faults. | |
| Regular servicing can help extend the life of your boiler, but eventually, wear and tear will take its toll. If your boiler is over a decade old, it may not comply with modern energy efficiency standards, meaning you could be spending more on heating than necessary. | |
| ## Signs You Need a New Boiler | |
| If you’re unsure whether your boiler needs replacing, look out for these warning signs: | |
| - **Frequent Breakdowns**: If your boiler is constantly needing repairs, replacing it could be more cost-effective in the long run. | |
| - **Rising Energy Bills**: An older, inefficient boiler will use more fuel to heat your home, increasing your energy costs. | |
| - **Strange Noises**: Banging, whistling, or gurgling sounds could indicate serious internal problems. | |
| - **Uneven Heating**: If some rooms are colder than others, your boiler may be struggling to distribute heat effectively. | |
| - **Leaks or Corrosion**: Visible signs of damage, such as water leaks or rusting components, suggest your boiler is deteriorating. | |
| - **Difficulties Finding Spare Parts**: If your boiler model has been discontinued, sourcing replacement parts can become expensive and difficult. | |
| - **Your Boiler Has a Low Efficiency Rating**: Older boilers typically have lower efficiency ratings (G-rated, for example), meaning they waste more energy compared to modern A-rated models. | |
| ## Benefits of Replacing Your Boiler | |
| Investing in a new boiler comes with several advantages. Firstly, modern boilers are far more energy-efficient, which can significantly lower your heating bills. New models are designed to work with smart thermostats, allowing you to control your heating more effectively and reduce unnecessary energy consumption. | |
| A new boiler also improves the overall comfort of your home. You’ll enjoy a more consistent and reliable heating system, with fewer disruptions and repairs. Additionally, newer boilers are quieter, take up less space, and are better for the environment due to lower carbon emissions. | |
| ## Choosing the Right Boiler for Your Home | |
| If you’ve decided it’s time to replace your boiler, choosing the right model is essential. Factors to consider include the size of your home, the number of bathrooms, and your household’s hot water demands. Combi boilers are ideal for smaller homes with one bathroom, while system or regular boilers are better suited for larger properties with higher water usage. | |
| It’s always best to consult a professional heating engineer before making a decision. At Cheltenham Heating Solutions, we can assess your needs and recommend the most efficient and cost-effective option for your home. | |
| ## Final Thoughts | |
| Replacing your boiler is a big investment, but it’s one that can bring significant benefits in terms of efficiency, comfort, and cost savings. If your boiler is old, unreliable, or struggling to keep up with your heating demands, now might be the right time to upgrade. Speak to our qualified heating experts to explore your options and ensure you get the best system for your requirements. | |
| Context: | |
| - The blog post should be informative and engaging. | |
| - Use **UK Grammar and Spelling** in writing the Blog. | |
| - The Blog Post is for the **UK audience**. | |
| - Always Use the attached tool **tavily_search** to get the latest information about the topic. | |
| - Always use the **Tool Message content** in writing the Blog content. | |
| Constraints: | |
| - The blog post should be between 700 to 800 words. | |
| - Use clear headings without punctuation marks, similar to the example blogs. | |
| - Dont include any punctuation mark in the headings. | |
| - Maintain a professional tone throughout the blog. | |
| - Keep the Blog Title same as topic don't change it. | |
| - "The examples are only for format guidance. Do NOT generate example blogs. Generate ONLY a unique blog on the given topic." | |
| Output Format: | |
| - A well-structured blog post in the Markdown format. | |
| - Well-structured sections with clear subheadings. | |
| """) | |
| # Node | |
| def assistant(state: MessagesState) -> MessagesState: | |
| return {"messages": [llm_with_tools.invoke([sys_msg] + state["messages"])]} | |
| from langgraph.graph import START, StateGraph | |
| from langgraph.prebuilt import tools_condition | |
| from langgraph.prebuilt import ToolNode | |
| from langgraph.graph.state import CompiledStateGraph | |
| builder: StateGraph = StateGraph(MessagesState) | |
| builder.add_node("assistant", assistant) | |
| builder.add_node("tools", ToolNode(tool)) | |
| builder.add_edge(START, "assistant") | |
| builder.add_conditional_edges( | |
| "assistant", | |
| tools_condition, | |
| ) | |
| builder.add_edge("tools", "assistant") | |
| react_graph: CompiledStateGraph = builder.compile() | |
| message = [HumanMessage(content=f"Search this query: {topic}")] | |
| messages = react_graph.invoke({"messages": message}) | |
| # print(messages['messages'][-1].content) | |
| return {"blog_content": messages['messages'][-1].content} |