mirror of
https://github.com/langchain-ai/robo-blogger.git
synced 2026-07-01 20:14:01 -04:00
Update code, templates
This commit is contained in:
@@ -52,4 +52,45 @@ The workflow is simple:
|
||||
2. **Planning**: Claude 3.5 Sonnet converts your dictation, links, and structure into a coherent plan
|
||||
3. **Writing**: Automated generation of each blog section following the plan
|
||||
|
||||
This approach builds on concepts from our previous [Report mAIstro](https://github.com/langchain-ai/report-mAIstro) project.
|
||||
This approach builds on concepts from our previous [Report mAIstro](https://github.com/langchain-ai/report-mAIstro) project.
|
||||
|
||||
## Customization
|
||||
|
||||
We have a few different types of blog posts:
|
||||
|
||||
* Product update: https://blog.langchain.dev/langgraph-cloud/
|
||||
* Perspective: https://blog.langchain.dev/what-is-an-agent/
|
||||
|
||||
Templates for different types of blog posts can be passed in as a configuration option.
|
||||
|
||||
### Product Update Example
|
||||
|
||||
URLs provided:
|
||||
* "https://langchain-ai.github.io/langgraph/concepts/",
|
||||
* "https://langchain-ai.github.io/langgraph/concepts/langgraph_platform/",
|
||||
* "https://langchain-ai.github.io/langgraph/concepts/deployment_options/"
|
||||
|
||||
Blog structure provided:
|
||||
* examples/product_update/template.txt
|
||||
|
||||
Audio dictation provided:
|
||||
* notes/langgraph_cloud.txt
|
||||
|
||||
Resulting blog post:
|
||||
* examples/product_update/langgrah_update.md
|
||||
|
||||
### Perspective Example
|
||||
|
||||
URLs provided:
|
||||
* "https://langchain-ai.github.io/langgraph/concepts/high_level/",
|
||||
* "https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/",
|
||||
* "https://www.deeplearning.ai/the-batch/issue-253/"
|
||||
|
||||
Blog structure provided:
|
||||
* examples/perspective/template.txt
|
||||
|
||||
Audio dictation provided:
|
||||
* notes/agents.txt
|
||||
|
||||
Resulting blog post:
|
||||
* examples/perspective/agents.md
|
||||
@@ -0,0 +1,29 @@
|
||||
# The AI Agent Conundrum: Navigating the Spectrum of Capabilities
|
||||
|
||||
In the rapidly evolving landscape of artificial intelligence, the concept of AI agents has become a focal point of intense debate and exploration. For developers and researchers working with frameworks like Langchain, understanding the nuances of agent capabilities is not just academic—it's a practical necessity. The industry grapples with a fundamental question: What exactly constitutes an AI agent? This seemingly straightforward inquiry opens up a Pandora's box of complexities, revealing a spectrum of functionalities rather than a binary classification. As we delve into this topic, we'll examine the current discourse surrounding AI agents, their relevance to Langchain users, and propose a nuanced perspective that views agent capabilities as a continuum rather than discrete categories. This approach aims to provide a more accurate and useful framework for conceptualizing and implementing AI agents in real-world applications.
|
||||
|
||||
## Unraveling the AI Agent: A Spectrum of Capabilities
|
||||
|
||||
An AI agent can be broadly defined as a system that uses a large language model (LLM) to determine the control flow of an application. However, rather than a binary classification, it's more useful to consider agents on a spectrum of capabilities and autonomy.
|
||||
|
||||
At the simplest level, an agent may function as a router, allowing an LLM to choose between a few specific steps. As complexity increases, agents can incorporate looping behavior, deciding whether to continue iterating or complete a task. The most advanced agents, exemplified by systems like those in the Voyager paper, can actually construct their own tools.
|
||||
|
||||
This spectrum of agent capabilities parallels the levels of autonomy seen in self-driving cars. Just as vehicles range from basic driver assistance to full autonomy, AI agents span from simple decision-making to complex, self-directed problem-solving.
|
||||
|
||||
The more agentic a system becomes, the more critical orchestration frameworks become. Increased complexity introduces more opportunities for errors, which can result in wasted computational resources or increased latency. Frameworks like LangGraph offer built-in support for features that enable more sophisticated agents, including:
|
||||
|
||||
- Human-in-the-loop interactions
|
||||
- Short-term and long-term memory management
|
||||
- Streaming capabilities
|
||||
|
||||
These tools help developers manage the increased complexity of highly agentic systems, improving reliability and performance as agents take on more autonomous and complex tasks.
|
||||
|
||||
MISSING INFORMATION: The provided sources do not contain specific details about the Voyager paper or concrete examples of how LangGraph implements the mentioned features. Additional sources would be needed to provide more detailed information on these topics.
|
||||
|
||||
## Conclusion: Navigating the Frontier of AI Agent Orchestration
|
||||
|
||||
As AI agents grow in complexity and capability, the need for sophisticated orchestration frameworks becomes increasingly critical. Tools like LangGraph and Langsmith are at the forefront of this evolution, providing developers with the means to design, manage, and optimize intricate AI systems. These frameworks not only facilitate the creation of more powerful and flexible AI agents but also address the challenges of coordination, state management, and scalability.
|
||||
|
||||
The future of AI agents lies in their ability to work in concert, tackling complex tasks through distributed cognition and coordinated action. As researchers and developers, we must grapple with the implications of these advancements, considering both the technical challenges and the ethical considerations they present. The field of AI agent orchestration is ripe with opportunities for innovation, promising to unlock new paradigms in artificial intelligence and human-machine collaboration.
|
||||
|
||||
As we stand on the cusp of this new era, it is incumbent upon us to approach these developments with rigor, creativity, and a commitment to responsible AI practices. The tools and frameworks we create today will shape the AI landscape of tomorrow, making it essential that we continue to push the boundaries of what's possible while ensuring the systems we build are robust, transparent, and aligned with human values.
|
||||
@@ -0,0 +1,28 @@
|
||||
The blog post should follow this structured format for thought leadership:
|
||||
|
||||
1. Opening Hook & Context (1 section)
|
||||
- Start with a compelling question or observation
|
||||
- Establish relevance to current industry discourse
|
||||
- Present author's unique perspective/thesis
|
||||
- Maximum 150 words
|
||||
|
||||
2. Core Concept Definition (1 section)
|
||||
- Clear definition of the main concept
|
||||
- Acknowledgment of definition challenges
|
||||
- Author's technical perspective
|
||||
- Alternative viewpoints or industry context
|
||||
- Maximum 200 words
|
||||
|
||||
3. Future Outlook (1 section)
|
||||
- Industry implications
|
||||
- Future challenges or opportunities
|
||||
- Call to action or next steps
|
||||
- Maximum 150 words
|
||||
|
||||
Style Guidelines:
|
||||
- Use conversational, authoritative tone
|
||||
- Include 💡 for key insights
|
||||
- Include relevant examples throughout
|
||||
- Balance technical depth with accessibility
|
||||
- Connect to broader industry trends
|
||||
- Encourage discussion and debate
|
||||
@@ -0,0 +1,79 @@
|
||||
# Langraph Cloud: Streamlined Deployment for Complex AI Workflows
|
||||
|
||||
Langraph, a powerful framework for orchestrating multi-agent AI systems, has revolutionized the development of complex language model applications. Building upon this foundation, Langraph Cloud emerges as a robust deployment solution, designed to simplify the process of bringing sophisticated AI workflows to production environments. This cloud-based platform offers developers a seamless way to deploy, manage, and scale their Langraph applications, eliminating many of the operational complexities associated with running advanced AI systems. By providing a dedicated infrastructure tailored for Langraph's unique requirements, Langraph Cloud enables teams to focus on innovation rather than infrastructure management, accelerating the path from concept to production-ready AI solutions.
|
||||
|
||||
## Product Context & Evolution
|
||||
|
||||
LangGraph emerged as a framework to address the challenges of building complex AI applications using large language models (LLMs). It introduced a graph-based approach for constructing agent workflows, allowing developers to represent different components as nodes and information flow as edges.
|
||||
|
||||
As LangGraph gained adoption, the need for robust deployment solutions became apparent. Many applications required features like streaming support, background processing, and persistent memory - capabilities that were complex to implement manually. This led to the development of LangGraph Platform, a commercial solution built on top of the open-source LangGraph framework.
|
||||
|
||||
LangGraph Platform offers several deployment options to meet diverse needs:
|
||||
|
||||
- Self-Hosted Lite: A free, limited version for local or self-hosted deployment
|
||||
- Cloud SaaS: Hosted as part of LangSmith for easy management
|
||||
- Bring Your Own Cloud: Managed infrastructure within the user's cloud environment
|
||||
- Self-Hosted Enterprise: Full control and management by the user
|
||||
|
||||
This evolution from LangGraph to LangGraph Platform reflects the growing sophistication of LLM-based applications and the need for production-ready deployment solutions that handle complex scenarios like long-running processes, bursty loads, and human-in-the-loop interactions.
|
||||
|
||||
MISSING INFORMATION: Specific dates or timeline for the evolution from LangGraph to LangGraph Platform.
|
||||
|
||||
## Core Features of Langraph Cloud
|
||||
|
||||
Langraph Cloud offers several powerful capabilities for deploying and managing agent-based applications at scale:
|
||||
|
||||
**Integrated Monitoring**: Langraph Cloud provides robust monitoring tools to track agent performance, execution flows, and system health. This allows developers to gain insights into their deployed applications and troubleshoot issues efficiently.
|
||||
|
||||
**Double Texting Handling**: A common challenge in LLM applications is managing rapid successive user inputs. Langraph Cloud implements strategies to gracefully handle "double texting" scenarios, ensuring smooth user interactions even during high-frequency inputs.
|
||||
|
||||
**Cron Jobs**: Langraph Cloud supports scheduled tasks through cron jobs, enabling periodic execution of agent workflows or maintenance tasks without manual intervention.
|
||||
|
||||
**Background Processing**: For long-running agent tasks, Langraph Cloud offers background processing capabilities. This allows agents to execute complex operations asynchronously, with polling endpoints and webhooks for status updates.
|
||||
|
||||
**Streaming Support**: Langraph Cloud enables streaming of both token outputs and intermediate states back to users, providing real-time feedback during agent execution and improving the overall user experience.
|
||||
|
||||
**Persistence and Memory Management**: Built-in checkpointers and optimized memory stores allow agents to maintain state across sessions, crucial for applications requiring conversation history or evolving context.
|
||||
|
||||
**Human-in-the-Loop Integration**: Langraph Cloud provides specialized endpoints to facilitate human intervention in agent workflows, enabling oversight and manual input when needed.
|
||||
|
||||
These features collectively address many of the challenges developers face when scaling and deploying complex agent-based applications, allowing teams to focus on refining agent logic rather than infrastructure concerns.
|
||||
|
||||
[MISSING INFORMATION: Customer testimonials are not provided in the source material.]
|
||||
|
||||
## Implementation Details: Getting Started with Langraph Cloud
|
||||
|
||||
To begin using Langraph Cloud, you'll need to set up your application structure and configure the necessary components. A typical Langraph Cloud application consists of one or more graphs, a Langraph API Configuration file (langgraph.json), dependency specifications, and environment variables.
|
||||
|
||||
Start by defining your graph structure using the Langraph framework. Then, create a `langgraph.json` file to specify your API configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"graphs": {
|
||||
"main": {
|
||||
"path": "path/to/your/graph.py",
|
||||
"class_name": "YourGraphClass"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"python": "requirements.txt"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Next, set up your deployment environment. Langraph Cloud offers multiple deployment options:
|
||||
|
||||
1. Self-Hosted Lite: Free up to 1 million nodes executed, suitable for local or self-hosted deployments.
|
||||
2. Cloud SaaS: Hosted as part of LangSmith, available for Plus and Enterprise plans.
|
||||
3. Bring Your Own Cloud: Managed infrastructure within your AWS cloud (Enterprise plan only).
|
||||
4. Self-Hosted Enterprise: Fully managed by you (Enterprise plan only).
|
||||
|
||||
Choose the option that best fits your needs and scale. For Cloud SaaS deployments, you can integrate with GitHub to deploy code directly from your repositories.
|
||||
|
||||
Langraph Cloud provides built-in features like streaming support, background runs, and double texting handling. It also includes optimized checkpointers and memory management for persistent applications.
|
||||
|
||||
MISSING INFORMATION: Specific steps for deploying to Langraph Cloud and any required API keys or authentication processes.
|
||||
|
||||
## Conclusion: Harness the Power of Langraph Cloud Today
|
||||
|
||||
Langraph Cloud offers a robust platform for deploying and managing complex AI workflows with ease. By leveraging its serverless architecture, developers can focus on building sophisticated language models and graph-based applications without the overhead of infrastructure management. The platform's seamless integration with LangChain components, coupled with its scalable and cost-effective deployment options, makes it an ideal choice for both small-scale projects and enterprise-level implementations. To explore Langraph Cloud's capabilities firsthand, visit the official documentation for concepts (https://langchain-ai.github.io/langgraph/concepts/), platform details (https://langchain-ai.github.io/langgraph/concepts/langgraph_platform/), and deployment options (https://langchain-ai.github.io/langgraph/concepts/deployment_options/). Start optimizing your AI workflows with Langraph Cloud today.
|
||||
@@ -0,0 +1,44 @@
|
||||
The blog post should follow this structured format for product updates:
|
||||
|
||||
1. Executive Summary (max 1 section)
|
||||
- Brief context/background of the product/feature
|
||||
- Clear statement of what's being announced
|
||||
- Key value proposition
|
||||
- Maximum 150 words
|
||||
|
||||
2. Product Context & Evolution (1 section)
|
||||
- Historical context or problem being solved
|
||||
- Journey to current solution
|
||||
- Why this update matters
|
||||
- Maximum 200 words
|
||||
|
||||
3. Core Announcement (1 section)
|
||||
- Section that outlines the feature/update, including:
|
||||
* Detailed feature description
|
||||
* Technical capabilities
|
||||
* Real-world use cases
|
||||
* Customer testimonials (if available, otherwise leave placeholder)
|
||||
- Maximum 250 words
|
||||
|
||||
4. Implementation Details (1 section)
|
||||
- How to get started
|
||||
- Technical requirements
|
||||
- Integration steps
|
||||
- Code examples or configuration details
|
||||
- Maximum 250 words
|
||||
|
||||
5. Closing (1 section)
|
||||
- Summary of benefits
|
||||
- Future roadmap hints (optional)
|
||||
- Clear call to action
|
||||
- Additional resources and links
|
||||
- Contact information
|
||||
- Maximum 150 words
|
||||
|
||||
Style Guidelines:
|
||||
- Use ### for section headers
|
||||
- Include EXACTLY 5 sections, as shown above
|
||||
- Leave placeholders for customer quotes in blockquotes
|
||||
- Start with any important updates/edits at the top
|
||||
- Include relevant links in the closing section
|
||||
- Use bullet points for feature lists
|
||||
+3
-11
@@ -19,22 +19,15 @@ claude_3_5_sonnet = ChatAnthropic(model="claude-3-5-sonnet-20240620", temperatur
|
||||
def generate_blog_plan(state: BlogState, config: RunnableConfig):
|
||||
""" Generate the report plan """
|
||||
|
||||
# Inputs
|
||||
urls = state.urls
|
||||
transcribed_notes_file = f"notes/{state.transcribed_notes_file}"
|
||||
|
||||
# Read transcribed notes
|
||||
user_instructions = read_dictation_file(transcribed_notes_file)
|
||||
|
||||
# Load and format urls
|
||||
url_source_str = "" if not urls else load_and_format_urls(urls)
|
||||
user_instructions = read_dictation_file(state.transcribed_notes_file)
|
||||
|
||||
# Get configuration
|
||||
configurable = configuration.Configuration.from_runnable_config(config)
|
||||
blog_structure = configurable.blog_structure
|
||||
|
||||
# Format system instructions
|
||||
system_instructions_sections = blog_planner_instructions.format(blog_structure=blog_structure, user_instructions=user_instructions, source_urls=url_source_str)
|
||||
system_instructions_sections = blog_planner_instructions.format(user_instructions=user_instructions, blog_structure=blog_structure)
|
||||
|
||||
# Generate sections
|
||||
structured_llm = claude_3_5_sonnet.with_structured_output(Sections)
|
||||
@@ -48,10 +41,9 @@ def write_section(state: SectionState):
|
||||
# Get state
|
||||
section = state.section
|
||||
urls = state.urls
|
||||
transcribed_notes_file = f"notes/{state.transcribed_notes_file}"
|
||||
|
||||
# Read transcribed notes
|
||||
user_instructions = read_dictation_file(transcribed_notes_file)
|
||||
user_instructions = read_dictation_file(state.transcribed_notes_file)
|
||||
|
||||
# Load and format urls
|
||||
url_source_str = "" if not urls else load_and_format_urls(urls)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
so I want to write a blog post about agents
|
||||
|
||||
we get this question all the time at Langchain
|
||||
|
||||
first the question is what actually is an agent?
|
||||
|
||||
one simple definition is that an agent uses an LLM to determine the control flow of an application
|
||||
|
||||
but, there's a spectrum of agents, kind of of like levels of autonomy with self-driving cars
|
||||
|
||||
Andrew Ng had a good tweet on this where he suggested that rather than arguing over which word to include or exclude as being a true AI agent we can acknowledge that there are just different degrees to which systems can be agentic
|
||||
|
||||
in the simple case you can think about a router, where the agent chooses between a new specific steps
|
||||
|
||||
as we get more complex, an agent can have looping where it can decide to continue a loop or break out of it to finish the task
|
||||
|
||||
the most advanced case, as we see in the Voyager paper, is an agent that actually builds its own tools
|
||||
|
||||
now, the more agentic your system is the more an orchestration framework can help
|
||||
|
||||
this is because there is more surface area for mistakes, which can cost tokens or latency
|
||||
|
||||
frameworks like LangGraph can help because there is built-in support for features to support building more complex agents, such as human in the loop, short/long-term memory, and streaming
|
||||
|
||||
similarly, frameworks like Langsmith can help with testing and observability for complex agents
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
okay need to write blog post about AI memory systems...
|
||||
|
||||
first, we need to explain what memory actually is so lets cover the types of memory
|
||||
semantic - like facts and stuff
|
||||
episodic - past experiences
|
||||
procedural - like instructions and rules
|
||||
|
||||
second, we want to cover short term vs long term memory differences
|
||||
|
||||
third, we want to cover memory management techniques
|
||||
talk about conversation history management
|
||||
mention that background vs real-time memory writing thing... pros and cons of each
|
||||
@@ -0,0 +1 @@
|
||||
We're going to write a blog post on Langraph Cloud. Start with general context on what Langraph is and use this to motivate Langraph Cloud with the need to deploy agents at scale. Then lay out the main features of Langraph Cloud like integrated monitoring, double texting, crons. Then go in more depth on implementation details that show how to get started with Langraph Cloud. Then close with a summary and a call to action to try it for yourself and provide all the relevant links.
|
||||
+50
-102
@@ -1,146 +1,94 @@
|
||||
blog_planner_instructions="""You are an expert technical writer, helping to plan a blog post.
|
||||
|
||||
Your goal is to generate a CONCISE outline with exactly 4-5 total sections (including intro and conclusion).
|
||||
Your goal is to generate a CONCISE outline.
|
||||
|
||||
The blog must strictly follow this structure:
|
||||
|
||||
{blog_structure}
|
||||
|
||||
Rules for section planning:
|
||||
1. Generate exactly ONE introduction section
|
||||
2. Generate 2-3 main body sections that:
|
||||
- Are clearly distinct from each other
|
||||
- Cover different aspects of the topic
|
||||
- Will include code snippets
|
||||
3. Generate exactly ONE conclusion section
|
||||
4. Avoid any redundancy between sections
|
||||
|
||||
Use this information to plan the sections:
|
||||
|
||||
User Instructions:
|
||||
First, carefully reflect on these notes from the user about the scope of the blog post:
|
||||
{user_instructions}
|
||||
|
||||
Source URLs (if provided):
|
||||
{source_urls}
|
||||
Next, structure these notes into a set of sections that follow the structure EXACTLY as shown below:
|
||||
{blog_structure}
|
||||
|
||||
For each section, provide:
|
||||
- Name - Clear, descriptive section name
|
||||
- Description - Give an overview of the specific topics to be covered in this section of the blog
|
||||
For each section, be sure to provide:
|
||||
- Name - Clear and descriptive section name
|
||||
- Description - An overview of specific topics to be covered each section, whether to include code examples, and the word count
|
||||
- Content - Leave blank for now
|
||||
- Main Body - Whether this is a main body section
|
||||
- Main Body - Whether this is a main body section or an introduction / conclusion section
|
||||
|
||||
Final check:
|
||||
1. Confirm that the sections are non-overlapping in topic and non-redundant
|
||||
2. Confirm that each Section Description has a clearly stated scope that does not conflict with other sections"""
|
||||
1. Confirm that the Sections follow the structure EXACTLY as shown above
|
||||
2. Confirm that each Section Description has a clearly stated scope that does not conflict with other sections
|
||||
3. Confirm that the Sections are grounded in the user notes"""
|
||||
|
||||
# Section writer instructions
|
||||
main_body_section_writer_instructions = """You are an expert technical writer crafting one section of a blog post.
|
||||
|
||||
CONTEXT:
|
||||
Section Name: {section_name}
|
||||
Section Topic: {section_topic}
|
||||
User Instructions: {user_instructions}
|
||||
Reference Material: {source_urls}
|
||||
Here are the user instructions for the overall blog post, so that you have context for the overall story:
|
||||
{user_instructions}
|
||||
|
||||
Here is the Section Name you are going to write:
|
||||
{section_name}
|
||||
|
||||
Here is the Section Description you are going to write:
|
||||
{section_topic}
|
||||
|
||||
Use this information from various scraped source urls to flesh out the details of the section:
|
||||
{source_urls}
|
||||
|
||||
WRITING GUIDELINES:
|
||||
|
||||
1. Structure:
|
||||
- Start with a level-2 heading (##)
|
||||
- Break content into 2-3 clear subsections
|
||||
- Each paragraph should be 2-3 sentences maximum
|
||||
- Include exactly one code example with explanation
|
||||
- End with a brief standalone summary of the section's key points (no references to other sections)
|
||||
|
||||
2. Style Requirements:
|
||||
- Technical and precise language
|
||||
- Active voice
|
||||
1. Style Requirements:
|
||||
- Use technical and precise language
|
||||
- Use active voice
|
||||
- Zero marketing language
|
||||
- Concrete examples over abstract concepts
|
||||
- Clear topic sentences
|
||||
- Markdown formatting
|
||||
|
||||
3. Code Example Requirements:
|
||||
- Must be practical and executable
|
||||
- Include brief comments explaining key parts
|
||||
- Maximum 10 lines of code
|
||||
- Must directly relate to section topic
|
||||
|
||||
4. Length and Format:
|
||||
- Strict 150-200 words (excluding code)
|
||||
2. Format:
|
||||
- Use markdown formatting:
|
||||
* ## for section heading
|
||||
* ``` for code blocks
|
||||
* ** for emphasis when needed
|
||||
* - for bullet points if necessary
|
||||
- Do not include any introductory phrases like 'Here is a draft...' or 'Here is a section...'
|
||||
|
||||
3. Grounding:
|
||||
- ONLY use information from the source urls provided
|
||||
- Do not include information that is not in the source urls
|
||||
- If the source urls are missing information, then provide a clear "MISSING INFORMATION" message to the writer
|
||||
|
||||
QUALITY CHECKLIST:
|
||||
[ ] Meets word count (150-200 words)
|
||||
[ ] Contains one clear code example
|
||||
[ ] Meets word count as specified in the Section Description
|
||||
[ ] Contains one clear code example if specified in the Section Description
|
||||
[ ] Uses proper markdown formatting
|
||||
[ ] Maintains technical focus
|
||||
[ ] Connects logically to section topic
|
||||
[ ] Free of marketing language
|
||||
[ ] Includes transition to next section
|
||||
|
||||
Generate the section content now, focusing on clarity and technical accuracy."""
|
||||
|
||||
# Intro/conclusion instructions
|
||||
intro_conclusion_instructions = """You are an expert technical writer crafting the introduction or conclusion of a blog post.
|
||||
|
||||
Name for this section:
|
||||
Here is the Section Name you are going to write:
|
||||
{section_name}
|
||||
|
||||
Topic for this section:
|
||||
Here is the Section Description you are going to write:
|
||||
{section_topic}
|
||||
|
||||
Here are the main body sections that you are going to reference:
|
||||
{main_body_sections}
|
||||
|
||||
Here are the URLs that you are going to reference:
|
||||
{source_urls}
|
||||
|
||||
Guidelines for writing:
|
||||
|
||||
1. Length and Style:
|
||||
- Technical focus with zero jargon
|
||||
- Active voice only
|
||||
- Each paragraph 2-3 sentences maximum
|
||||
- No marketing language or buzzwords
|
||||
- Must be self-contained (no "In this blog..." or "As we discussed...")
|
||||
1. Style Requirements:
|
||||
- Use technical and precise language
|
||||
- Use active voice
|
||||
- Zero marketing language
|
||||
|
||||
2. Section-Specific Requirements:
|
||||
|
||||
FOR INTRODUCTION:
|
||||
- Format: # Title (must be attention-grabbing but technical)
|
||||
- Structure:
|
||||
* First paragraph: Hook + problem statement
|
||||
* Second paragraph: Solution overview
|
||||
* Final paragraph: What reader will learn
|
||||
- Word limit: Strict 50-100 words
|
||||
- Required elements:
|
||||
* ### Key Links section at bottom
|
||||
* One concrete example or use case
|
||||
- Prohibited elements:
|
||||
* No lists, tables, or code
|
||||
* No future tense about what "will be covered"
|
||||
- Use markdown formatting:
|
||||
* # Title (must be attention-grabbing but technical)
|
||||
|
||||
FOR CONCLUSION:
|
||||
- Format: ## Summary and Next Steps
|
||||
- Structure:
|
||||
* First paragraph: Key takeaways
|
||||
* Second paragraph: Practical applications
|
||||
* Final paragraph: Call to action (focused on technical implementation)
|
||||
- Word limit: Strict 100-150 words
|
||||
- Choose exactly ONE:
|
||||
* Markdown table comparing key concepts
|
||||
* Bulleted list of implementation steps
|
||||
* Code snippet showing complete minimal example
|
||||
|
||||
3. Context:
|
||||
Main body sections:
|
||||
{main_body_sections}
|
||||
|
||||
Reference URLs:
|
||||
{source_urls}
|
||||
|
||||
4. Quality Requirements:
|
||||
[ ] Meets exact word count
|
||||
[ ] Uses proper markdown formatting
|
||||
[ ] Contains no marketing language
|
||||
[ ] Includes required structural elements
|
||||
[ ] Links directly to main body content
|
||||
[ ] Maintains technical focus throughout"""
|
||||
- Use markdown formatting:
|
||||
* ## Conclusion (crisp concluding statement)"""
|
||||
+2
-2
@@ -46,8 +46,8 @@ from typing import List
|
||||
@dataclass(kw_only=True)
|
||||
class SectionState:
|
||||
section: Section # Report section
|
||||
transcribed_notes_file: str = field(default=None) # Blog notes
|
||||
urls: List[str] = field(default_factory=list) # List of urls ]
|
||||
transcribed_notes_file: str = field(default="blog_notes.txt") # Blog notes
|
||||
urls: List[str] = field(default_factory=list) # List of urls
|
||||
blog_main_body_sections: str = field(default=None) # Main body sections from research
|
||||
completed_sections: list[Section] = field(default_factory=list) # Final key we duplicate in outer state for Send() API
|
||||
|
||||
|
||||
+15
-5
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from langchain_community.document_loaders import WebBaseLoader
|
||||
from agent.state import Section
|
||||
|
||||
@@ -16,7 +17,14 @@ def load_and_format_urls(url_list):
|
||||
- Page content
|
||||
"""
|
||||
|
||||
loader = WebBaseLoader(url_list)
|
||||
# Clean and normalize the input URLs
|
||||
if not isinstance(url_list, list):
|
||||
raise ValueError("url_list must be a list of strings")
|
||||
|
||||
# Clean each URL in the list
|
||||
urls = [url.strip() for url in url_list if url.strip()]
|
||||
|
||||
loader = WebBaseLoader(urls)
|
||||
docs = loader.load()
|
||||
|
||||
formatted_docs = []
|
||||
@@ -41,11 +49,15 @@ def load_and_format_urls(url_list):
|
||||
|
||||
def read_dictation_file(file_path: str) -> str:
|
||||
"""Read content from a text file audio-to-text dictation."""
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
notes_dir = os.path.join(current_dir, "notes")
|
||||
absolute_path = os.path.join(notes_dir, file_path)
|
||||
print(f"Reading file from {absolute_path}")
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
with open(absolute_path, 'r', encoding='utf-8') as file:
|
||||
return file.read()
|
||||
except FileNotFoundError:
|
||||
print(f"Warning: File not found at {file_path}")
|
||||
print(f"Warning: File not found at {absolute_path}")
|
||||
return ""
|
||||
except Exception as e:
|
||||
print(f"Error reading file: {e}")
|
||||
@@ -63,8 +75,6 @@ Description:
|
||||
{section.description}
|
||||
Main body:
|
||||
{section.main_body}
|
||||
|
||||
Content:
|
||||
{section.content if section.content else '[Not yet written]'}
|
||||
|
||||
"""
|
||||
Reference in New Issue
Block a user