griptape-ai / griptape

Modular Python framework for AI agents and workflows with chain-of-thought reasoning, tools, and memory.
https://www.griptape.ai
Apache License 2.0
2.01k stars 170 forks source link

Documentation example fails on Ollama Llama 3.1 #1052

Closed ssuukk closed 2 months ago

ssuukk commented 3 months ago

Describe the bug I copypasted tutorial example, but updated it to use local Llama 3.1. The example fails with Wrong key 'url'

To Reproduce

from griptape.config import StructureConfig
from griptape.drivers import OllamaPromptDriver
from griptape.tools import Calculator
from griptape.structures import Agent

from griptape.memory.structure import ConversationMemory
from griptape.structures import Pipeline
from griptape.tasks import ToolkitTask, PromptTask
from griptape.tools import WebScraper, FileManager, TaskMemoryClient

agent = Agent(
    config=StructureConfig(
        prompt_driver=OllamaPromptDriver(
            model="llama3.1", host="http://localhost:30001"
        ),
    ),
    tools=[Calculator()],
)
agent.run("What is (192 + 12) ^ 4")

pipeline = Pipeline(
    conversation_memory=ConversationMemory(), config=StructureConfig(
        prompt_driver=OllamaPromptDriver(
            model="llama3.1", host="http://localhost:30001"
        ),
    ),
)

pipeline.add_tasks(
    # Load up the first argument from `pipeline.run`.
    ToolkitTask(
        "{{ args[0] }}",
        # Add tools for web scraping, and file management
        tools=[WebScraper(off_prompt=True), FileManager(off_prompt=True), TaskMemoryClient(off_prompt=False)]
    ),
    # Augment `input` from the previous task.
    PromptTask(
        "Say the following in spanish: {{ parent_output }}"
    )
)

pipeline.run(
    "Load https://www.griptape.ai, summarize it, and store it in griptape.txt"
)

It fails with:

                             Traceback (most recent call last):                 
                               File                                             
                             "/home/qus/anaconda3/envs/moj_chat2/lib/python3.10/
                             site-packages/griptape/tasks/actions_subtask.py",  
                             line 303, in __validate_action                     
                                 activity_schema.validate(action.input)         
                               File                                             
                             "/home/qus/anaconda3/envs/moj_chat2/lib/python3.10/
                             site-packages/schema.py", line 489, in validate    
                                 raise SchemaError(                             
                             schema.SchemaError: Key 'values' error:            
                             Wrong key 'url' in {'content':                     
                             'WebScraper_get_content', 'path': 'griptape.txt',  
                             'url': 'https://www.griptape.ai'}   

Expected behavior Whatever that example was supposed to do.

Screenshots

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

cjkindel commented 3 months ago

The pipeline example included in your code snippet exceeds the complex reasoning capability of llama3.1. While Griptape enables easy switching of AI models, not all models are equal in capability. While we work to improve our documentation on this subject, we suggest using a ToolTask for llama3.1.