Fix Knowledge docs Spaceflight News API dead link

This commit is contained in:
Rok Benko
2024-12-09 16:41:29 +01:00
committed by Tony Kipkemboi
parent 46be5e8097
commit 5a7a323f3a

View File

@@ -12,11 +12,9 @@ Knowledge in CrewAI is a powerful system that allows AI agents to access and uti
Think of it as giving your agents a reference library they can consult while working.
<Info>
Key benefits of using Knowledge:
- Enhance agents with domain-specific information
- Support decisions with real-world data
- Maintain context across conversations
- Ground responses in factual information
Key benefits of using Knowledge: - Enhance agents with domain-specific
information - Support decisions with real-world data - Maintain context across
conversations - Ground responses in factual information
</Info>
## Supported Knowledge Sources
@@ -25,14 +23,10 @@ CrewAI supports various types of knowledge sources out of the box:
<CardGroup cols={2}>
<Card title="Text Sources" icon="text">
- Raw strings
- Text files (.txt)
- PDF documents
- Raw strings - Text files (.txt) - PDF documents
</Card>
<Card title="Structured Data" icon="table">
- CSV files
- Excel spreadsheets
- JSON documents
- CSV files - Excel spreadsheets - JSON documents
</Card>
</CardGroup>
@@ -122,7 +116,6 @@ crewai reset-memories --knowledge
This is useful when you've updated your knowledge sources and want to ensure that the agents are using the most recent information.
## Custom Knowledge Sources
CrewAI allows you to create custom knowledge sources for any type of data by extending the `BaseKnowledgeSource` class. Let's create a practical example that fetches and processes space news articles.
@@ -220,6 +213,7 @@ result = crew.kickoff(
inputs={"user_question": "What are the latest developments in space exploration?"}
)
```
```output Output
# Agent: Space News Analyst
## Task: Answer this question about space news: What are the latest developments in space exploration?
@@ -243,10 +237,12 @@ The latest developments in space exploration, based on recent space news article
7. The Center for AEroSpace Autonomy Research (CAESAR) at Stanford University is focusing on spacecraft autonomy. The center held a kickoff event on May 22, 2024, to highlight the industry, academia, and government collaboration it seeks to foster. This could lead to significant advancements in autonomous spacecraft technology. [Source: SpaceNews](https://spacenews.com/stanford-center-focuses-on-spacecraft-autonomy/)
```
</CodeGroup>
#### Key Components Explained
1. **Custom Knowledge Source (`SpaceNewsKnowledgeSource`)**:
- Extends `BaseKnowledgeSource` for integration with CrewAI
- Configurable API endpoint and article limit
- Implements three key methods:
@@ -255,10 +251,12 @@ The latest developments in space exploration, based on recent space news article
- `add()`: Processes and stores the content
2. **Agent Configuration**:
- Specialized role as a Space News Analyst
- Uses the knowledge source to access space news
3. **Task Setup**:
- Takes a user question as input through `{user_question}`
- Designed to provide detailed answers based on the knowledge source
@@ -267,6 +265,7 @@ The latest developments in space exploration, based on recent space news article
- Handles input/output through the kickoff method
This example demonstrates how to:
- Create a custom knowledge source that fetches real-time data
- Process and format external data for AI consumption
- Use the knowledge source to answer specific user questions
@@ -274,13 +273,15 @@ This example demonstrates how to:
#### About the Spaceflight News API
The example uses the [Spaceflight News API](https://api.spaceflightnewsapi.net/v4/documentation), which:
The example uses the [Spaceflight News API](https://api.spaceflightnewsapi.net/v4/docs/), which:
- Provides free access to space-related news articles
- Requires no authentication
- Returns structured data about space news
- Supports pagination and filtering
You can customize the API query by modifying the endpoint URL:
```python
# Fetch more articles
recent_news = SpaceNewsKnowledgeSource(
@@ -299,14 +300,14 @@ recent_news = SpaceNewsKnowledgeSource(
<AccordionGroup>
<Accordion title="Content Organization">
- Keep chunk sizes appropriate for your content type
- Consider content overlap for context preservation
- Organize related information into separate knowledge sources
- Keep chunk sizes appropriate for your content type - Consider content
overlap for context preservation - Organize related information into
separate knowledge sources
</Accordion>
<Accordion title="Performance Tips">
- Adjust chunk sizes based on content complexity
- Configure appropriate embedding models
- Consider using local embedding providers for faster processing
- Adjust chunk sizes based on content complexity - Configure appropriate
embedding models - Consider using local embedding providers for faster
processing
</Accordion>
</AccordionGroup>