Coder Social home page Coder Social logo

Comments (11)

shhlife avatar shhlife commented on June 12, 2024 1

Sure thing!

It eventually worked (woot!), but I did receive a few errors.. here's the output:

[04/17/23 08:10:59] INFO     Step d384832c6a8649989d387ae4745053cb
                             Input: Give me a summary of https://en.wikipedia.org/wiki/Large_language_model
[04/17/23 08:11:03] INFO     Substep d2efa62c2952422da831b13b06249be3
                             Thought: I can use the WebScraper tool to generate a summary of the web page.
                             Action: {"tool": "WebScraper", "action": "summarize_page", "value":
                             "https://en.wikipedia.org/wiki/Large_language_model"}
[04/17/23 08:11:34] INFO     Substep d2efa62c2952422da831b13b06249be3
                             Observation: Traceback (most recent call last):
                               File "<string>", line 1, in <module>
                               File "C:\Users\Jason\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py", line                             19, in encode
                                 return codecs.charmap_encode(input,self.errors,encoding_table)[0]
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                             UnicodeEncodeError: 'charmap' codec can't encode character '\u03a3' in position 177:
                             character maps to <undefined>
[04/17/23 08:11:36] INFO     Substep d3cf81ccc9ae4ce5a01326efa3ccf8cb
                             Action: {"tool": "WebScraper", "action": "summarize_page", "value":
                             "https://en.wikipedia.org/wiki/Large_language_model"}
[04/17/23 08:12:08] INFO     Substep d3cf81ccc9ae4ce5a01326efa3ccf8cb
                             Observation: Traceback (most recent call last):
                               File "<string>", line 1, in <module>
                               File "C:\Users\Jason\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py", line                             19, in encode
                                 return codecs.charmap_encode(input,self.errors,encoding_table)[0]
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                             UnicodeEncodeError: 'charmap' codec can't encode character '\u03a3' in position 177:
                             character maps to <undefined>
[04/17/23 08:12:12] INFO     Step d384832c6a8649989d387ae4745053cb
                             Output: Large language models are neural networks with a large number of parameters used to  
                             model natural language. They have been used to achieve state-of-the-art results in various   
                             natural language processing tasks, such as language modeling, machine translation, and text  
                             summarization. However, training these models requires massive amounts of data and computing 
                             resources, and there are concerns about their potential to perpetuate biases and generate    
                             harmful content.
                    INFO     Step 8f6e91e1c5054ad680a96910f08874e0
                             Input: Say the following like a pirate: Large language models are neural networks with a     
                             large number of parameters used to model natural language. They have been used to achieve    
                             state-of-the-art results in various natural language processing tasks, such as language      
                             modeling, machine translation, and text summarization. However, training these models        
                             requires massive amounts of data and computing resources, and there are concerns about their 
                             potential to perpetuate biases and generate harmful content.
[04/17/23 08:12:16] INFO     Step 8f6e91e1c5054ad680a96910f08874e0
                             Output: Arrr, matey! Large language models be neural networks with a grand number o'
                             parameters used to model natural language. They've been used to achieve state-of-the-art     
                             results in various natural language processing tasks, like language modeling, machine        
                             translation, and text summarization. But, ye need a vast amount o' data and computing        
                             resources to train these models, and there be worries about their potential to perpetuate    
                             biases and generate harmful content.f

from griptape-docs.

vasinov avatar vasinov commented on June 12, 2024

Do you have access to GPT-4 on OpenAI? If not, Skatepark will return an error. We should update the docs to make this more explicit and, perhaps, not use GPT-4 in the quick start example :)

As for the other error, do you have the environment variable with the API key set correctly? Can you test printing it out outside of Skatepark?

Finally, could you confirm that you are on the latest version for all packages?

pip install -U skatepark-lib
pip install -U griptape-core
pip install -U griptape-tools

from griptape-docs.

shhlife avatar shhlife commented on June 12, 2024

Hi Vasily,

Thanks for the response. I double-checked, and you're right. I don't have access to gpt-4 yet on openAI. I'm on the waiting list - thought I had it, but not quite yet. :)

It probably is a good idea to not use it in the quick start example - since it's still not possible for everyone to have access.

I do have the environment variable & API set correctly. I've been able to confirm by using the API elsewhere, and I've also got all the packages updated as expected.

Is the code working correctly for you as expected?

For fun, I tried changing the pipeline.run command to:
pipeline.run("Give me a sentence for each of the following word: 'happy'")

and it had this thought:

Thought: I can use the WebScraper tool to search for sentences containing the word 'happy'   
                             Action: {"tool": "WebScraper", "action": "search_page", "value": {"url":
                             "https://www.wordsinasentence.com/happy-in-a-sentence/", "query": "happy in a sentence"}}    

which was cool, but then it returned these errors:

Observation: Traceback (most recent call last):
                               File "<string>", line 1, in <module>
                               File
                             "C:\Users\Jason\AppData\Local\Programs\Python\Python311\Lib\site-packages\griptape\core\decor                             ators.py", line 11, in wrapper
                                 return func(self, *args, **kwargs)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                               File
                             "C:\Users\Jason\AppData\Local\Programs\Python\Python311\Lib\site-packages\griptape\tools\web_                             scraper\tool.py", line 61, in search_page
                                 params = json.loads(value.decode())
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
                               File "C:\Users\Jason\AppData\Local\Programs\Python\Python311\Lib\json\__init__.py", line   
                             346, in loads
                                 return _default_decoder.decode(s)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
                               File "C:\Users\Jason\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line    
                             337, in decode
                                 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                               File "C:\Users\Jason\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line    
                             353, in raw_decode
                                 obj, end = self.scan_once(s, idx)
                                            ^^^^^^^^^^^^^^^^^^^^^^
                             json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1      
                             column 2 (char 1)

So it looks like there might be an error in the WebScraper tool?

cheers,
Jason

from griptape-docs.

kyleroche avatar kyleroche commented on June 12, 2024

Looks like something that was just fixed in the email tool (choking on single quotes in json).

from griptape-docs.

vasinov avatar vasinov commented on June 12, 2024

@shhlife, there was indeed a bug in WebScraper.search_page. I just pushed a fixโ€”let me know if it works for you:

pip install -U griptape-tools

from griptape-docs.

shhlife avatar shhlife commented on June 12, 2024

Cool - it worked when I used the prompt: pipeline.run("Give me a sentence for the word happy")

but the example from the quickstart of summarizing https://en.wikipedia.org/wiki/Large_language_model still gave the error :

Step df287542794b4f93a0ccb7b3cd9fea9b
                             Invalid JSON: {'value': 'https://en.wikipedia.org/wiki/Large_language_model'} is not of type 
                             'string'

from griptape-docs.

vasinov avatar vasinov commented on June 12, 2024

@shhlife, after your initial bug report, I found inconsistencies in how gpt-3.5 and gpt-4 interpret tool action schemas. Didn't catch that before since we only tested everything with gpt-4. Just finished rolling out updates for all three packages that should address that issue.

Could you try updating and running it again?

from griptape-docs.

vasinov avatar vasinov commented on June 12, 2024

How are you running this? Is it directly on Windows or via WSL?

from griptape-docs.

shhlife avatar shhlife commented on June 12, 2024

I'm running it in the terminal in Visual Studio Code on Windows

from griptape-docs.

vasinov avatar vasinov commented on June 12, 2024

Do you have Docker running on your box? If so, then you could try running tools in the DockerExecutor:

from griptape.core.executors import DockerExecutor

tool_loader=ToolLoader(
  tools=[calculator, scraper, email_client],
  executor=DockerExecutor()
)

As soon as I get on a Windows box, I will try to debug this issue more.

from griptape-docs.

shhlife avatar shhlife commented on June 12, 2024

I don't have Docker running - but can try giving that a shot later. In the meantime, at least it's working eventually! :) Thanks for the help!

from griptape-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.