-
Notifications
You must be signed in to change notification settings - Fork 44.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into aarushikansal/exa-api
- Loading branch information
Showing
13 changed files
with
193 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
autogpt_platform/autogpt_libs/autogpt_libs/feature_flag/client_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
59 changes: 59 additions & 0 deletions
59
autogpt_platform/backend/backend/blocks/jina/fact_checker.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from urllib.parse import quote | ||
|
||
import requests | ||
|
||
from backend.blocks.jina._auth import ( | ||
JinaCredentials, | ||
JinaCredentialsField, | ||
JinaCredentialsInput, | ||
) | ||
from backend.data.block import Block, BlockCategory, BlockOutput, BlockSchema | ||
from backend.data.model import SchemaField | ||
|
||
|
||
class FactCheckerBlock(Block): | ||
class Input(BlockSchema): | ||
statement: str = SchemaField( | ||
description="The statement to check for factuality" | ||
) | ||
credentials: JinaCredentialsInput = JinaCredentialsField() | ||
|
||
class Output(BlockSchema): | ||
factuality: float = SchemaField( | ||
description="The factuality score of the statement" | ||
) | ||
result: bool = SchemaField(description="The result of the factuality check") | ||
reason: str = SchemaField(description="The reason for the factuality result") | ||
error: str = SchemaField(description="Error message if the check fails") | ||
|
||
def __init__(self): | ||
super().__init__( | ||
id="d38b6c5e-9968-4271-8423-6cfe60d6e7e6", | ||
description="This block checks the factuality of a given statement using Jina AI's Grounding API.", | ||
categories={BlockCategory.SEARCH}, | ||
input_schema=FactCheckerBlock.Input, | ||
output_schema=FactCheckerBlock.Output, | ||
) | ||
|
||
def run( | ||
self, input_data: Input, *, credentials: JinaCredentials, **kwargs | ||
) -> BlockOutput: | ||
encoded_statement = quote(input_data.statement) | ||
url = f"https://g.jina.ai/{encoded_statement}" | ||
|
||
headers = { | ||
"Accept": "application/json", | ||
"Authorization": f"Bearer {credentials.api_key.get_secret_value()}", | ||
} | ||
|
||
response = requests.get(url, headers=headers) | ||
response.raise_for_status() | ||
data = response.json() | ||
|
||
if "data" in data: | ||
data = data["data"] | ||
yield "factuality", data["factuality"] | ||
yield "result", data["result"] | ||
yield "reason", data["reason"] | ||
else: | ||
raise RuntimeError(f"Expected 'data' key not found in response: {data}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "autogpt-platform-backend" | ||
version = "0.3.3" | ||
version = "0.3.4" | ||
description = "A platform for building AI-powered agentic workflows" | ||
authors = ["AutoGPT <[email protected]>"] | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "frontend", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# **How to Create an AI Agent as a Block in AutoGPT** | ||
|
||
## **Overview** | ||
|
||
This guide explains how to create a reusable agent block that can be used as a component in other agents. | ||
|
||
<center><iframe width="560" height="315" src="https://www.youtube.com/embed/G5t5wbfomNE?si=dek4KKAPmx8DVOxm" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></center> | ||
|
||
## **What Are Agent Blocks?** | ||
|
||
Agent blocks are pre-configured, reusable AI workflows that can be used as components within larger automation systems. Think of them as "smart building blocks" - each agent block is itself a complete workflow that can: | ||
|
||
- Accept specific inputs | ||
- Process data using AI and traditional automation | ||
- Produce defined outputs | ||
- Be easily reused in different contexts | ||
|
||
The power of agent blocks lies in their modularity. Once you create an agent with a specific capability (like translating text or analyzing sentiment), you can reuse it as a single block in other workflows. This means you can: | ||
|
||
- Combine multiple agent blocks to create more complex automations | ||
- Reuse proven workflows without rebuilding them | ||
- Share agent blocks with other users | ||
- Create hierarchical systems where specialized agents work together | ||
|
||
For example, a content creation workflow might combine several agent blocks: | ||
|
||
- A research agent block that gathers information | ||
- A writing agent block that creates the initial draft | ||
- An editing agent block that polishes the content | ||
- A formatting agent block that prepares the final output | ||
|
||
## **Creating the Base Agent** | ||
|
||
### **Required Components** | ||
|
||
1. Input Block | ||
2. AI Text Generator Block | ||
3. Output Block | ||
|
||
### **Step-by-Step Setup** | ||
|
||
1. **Add and Configure Blocks** | ||
* Add an Input Block | ||
* Add an AI Text Generator Block | ||
* Add an Output Block | ||
2. **Connect Components** | ||
* Connect Input's result to AI Text Generator's Prompt | ||
* Connect AI Text Generator's response to Output's value | ||
3. **Name the Components** | ||
* Name the Input Block: "question" | ||
* Name the Output Block: "answer" | ||
4. **Save the Agent** | ||
* Choose a descriptive name (e.g., "Weather Agent") | ||
* Click Save | ||
|
||
|
||
|
||
## **Converting to a Block** | ||
|
||
1. **Access the Block Menu** | ||
* Go to the Builder interface | ||
* Click the Blocks menu | ||
* Click the agent tag or search the name of your agent | ||
2. **Using the Agent Block** | ||
* Click on the agent block to add to your workflow | ||
* Save the new agent with a descriptive name (e.g., "Weather Agent") | ||
|
||
## **Testing the Agent Block** | ||
|
||
1. **Run the Agent** | ||
* Enter a test question (e.g., "How far is the Earth from the Moon?") | ||
* Click Run | ||
2. **View Results** | ||
* Option 1: Check "Agent Outputs" section* | ||
* Option 2: Click "View More" for detailed results | ||
|
||
*Note: if there is no output block then the "Agent Outputs" button will show up blank. You can see the output under view more or at bottom of the block. | ||
|
||
## **Advanced Usage** | ||
|
||
* You can make more complex agents by combining multiple agent blocks | ||
* Chain different agents together for more sophisticated workflows | ||
|
||
## **Note** | ||
|
||
This is a basic example that can be expanded upon to create more complex agent blocks with additional functionality. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters