Comments (6)
@ysammy, this particular activity is going to be re-written from scratch and allow for better customization, once we resolve #33. Right now summarize_text
doesn't even use the driver as it depends on LlamaIndex.
Which tool were you trying to use memory summarization with?
from griptape.
I pasted the example from this section into a notebook. The one difference is setting the prompt driver explicitly with my API key. I went this route because I found that the example wasn't respecting openai.api_key
or os.environ["OPENAI_API_KEY"]
when run in a notebook.
# Pipelines represent sequences of tasks.
pipeline = Pipeline(
memory=ConversationMemory(),
prompt_driver=OpenAiPromptDriver(
api_key=OPENAI_API_KEY,
),
)
The output I get is as follows:
[06/22/23 10:07:20] INFO Task d5904fcd762b4a9aaa9bbe80df5c20aa
Input: Load https://www.griptape.ai, summarize it, and store it in griptape.txt
[06/22/23 10:07:22] INFO Subtask c3e97f0ad62741c8b7c849355c1e6883
Thought: I can use the WebScraper tool to load the website, then use the
TextToolMemory to store the content, and finally use the summarize activity to
generate a summary. After that, I can use the FileManager tool to save the summary to
a file on disk.
Action: {"type": "tool", "name": "WebScraper", "activity": "get_content", "input":
{"values": {"url": "https://www.griptape.ai"}}}
[06/22/23 10:07:23] INFO Subtask c3e97f0ad62741c8b7c849355c1e6883
Observation: Output of "WebScraper.get_content" was stored in memory "TextToolMemory"
with the following artifact namespace: bc69a45812dc46fd8a51f07b29aee96a
[06/22/23 10:07:24] INFO Subtask fcb16c0d788c4673bacc14aaf3fa5aaf
Action: {"type": "memory", "name": "TextToolMemory", "activity": "summarize", "input":
{"values": {"artifact_namespace": "bc69a45812dc46fd8a51f07b29aee96a"}}}
[06/22/23 10:07:31] INFO Subtask fcb16c0d788c4673bacc14aaf3fa5aaf
Observation: error summarizing text: RetryError[<Future at 0x2b74942d0 state=finished
raised AuthenticationError>]
ERROR:root:PromptDriver.run attempt 0 failed: No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <PATH>'. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details.
Retrying in 1 seconds
Tracing the code to where error summarizing text
is raised in an exception led me to the issue I referenced. I suspect it is because the OpenAiPromptDriver
created inline doesn't include my API key.
from griptape.
I went this route because I found that the example wasn't respecting openai.api_key or os.environ["OPENAI_API_KEY"] when run in a notebook.
Does that mean that you tried setting the OPENAI_API_KEY
env var in the notebook before running the code and it didn't work? If so, can you make sure it was set correctly:
os.environ["OPENAI_API_KEY"] = <your key>
assert os.environ["OPENAI_API_KEY"]
If that works but the env var doesn't get picked up by the openai
lib then there is something weird going on :)
from griptape.
Can confirm that the assertion passes and the default OpenAiPromptDriver
for the pipeline cannot find the key. I have not yet had a chance to debug why this is the case.
from griptape.
I figured out what the issue is...
openai.api_key
, which defaults to OPENAY_API_KEY
, is loaded during the import. Setting OPENAI_API_KEY
later doesn't do anything. I pushed a fix for this to main
. Let me know if it fixes the issue in your notebook.
from griptape.
I figured it was something like that. Confirmed this works!
from griptape.
Related Issues (20)
- Add Gemini Image Query Driver
- Add Google Gemini support
- BedrockLlamaPromptModelDriver does not apply input truncation, resulting in ValidationError HOT 4
- Add Support For Mistral on AWS Bedrock
- BedrockClaudePromptModelDriver results in ValidationError for Claude V3* models due to incorrect invoke struct HOT 1
- JsonExtractionEngine produces malformed JSON
- ignored_exception_types not working as intended
- vLLM endpoint support HOT 4
- CodeExecutionTask doesn't handle inputs correctly when in a Workflow HOT 2
- Calculating Max Output Tokens Is Inconsistent Across Prompt Drivers
- Driver secrets are serializable
- Azure OpenAI api version `2023-12-01-preview` deprecation HOT 2
- Bing Search Wrapper for WebSearch tool HOT 1
- Add model to emitted events.
- Use rich.print in Chat utility HOT 5
- Bump Pinecone from 2 to 3 HOT 1
- Add StructureRunDrivers to the documentation sidebar
- VectorQueryEngine issue with loading artifacts from query HOT 1
- Add `AzureOpenAiStructureConfig`
- Add DuckDuckGo Search tool
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from griptape.