griptape icon indicating copy to clipboard operation
griptape copied to clipboard

Documentation example fails on Ollama Llama 3.1

Open ssuukk opened this issue 6 months ago • 1 comments

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):

  • OS: Ubuntu on WSL2
  • Version [e.g. 0.5.1]

Additional context Add any other context about the problem here.

ssuukk avatar Aug 08 '24 06:08 ssuukk