Comments (16)
I also encountered the same problem as @kraonn , I ran user.workflow.F136CC17-C621-4B37-8CBF-70F810CC658D % python3 src/text_chat.py $1
in the terminal to return the result
Traceback (most recent call last):
File "/Users/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F136CC17-C621-4B37-8CBF-70F810CC658D/src/text_chat.py", line 8, in <module>
from error_handling import env_value_error_if_needed, exception_response
File "/Users/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F136CC17-C621-4B37-8CBF-70F810CC658D/src/error_handling.py", line 9, in <module>
import openai
File "/Users/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F136CC17-C621-4B37-8CBF-70F810CC658D/src/libs/openai/__init__.py", line 9, in <module>
from openai.api_resources import (
File "/Users/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F136CC17-C621-4B37-8CBF-70F810CC658D/src/libs/openai/api_resources/__init__.py", line 7, in <module>
from openai.api_resources.embedding import Embedding # noqa: F401
File "/Users/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F136CC17-C621-4B37-8CBF-70F810CC658D/src/libs/openai/api_resources/embedding.py", line 7, in <module>
from openai.datalib import numpy as np, assert_has_numpy
File "/Users/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.F136CC17-C621-4B37-8CBF-70F810CC658D/src/libs/openai/datalib.py", line 22, in <module>
import pandas
File "/opt/anaconda3/lib/python3.9/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401
File "/opt/anaconda3/lib/python3.9/site-packages/pandas/compat/__init__.py", line 17, in <module>
from pandas._typing import F
File "/opt/anaconda3/lib/python3.9/site-packages/pandas/_typing.py", line 79, in <module>
ArrayLike = Union["ExtensionArray", np.ndarray]
AttributeError: module 'numpy' has no attribute 'ndarray'
from chatfred.
Neither was, I manually installed both.
Now it works fine from the terminal if I invoke the script there, but the ChatFred workflow still is returning the same "fishy internet connection" error message.
from chatfred.
SUCCESS! Seeing the actual error message made it clear that I'd somehow gotten my API key into the configuration field twice, which made it an invalid API key. Deleting my API key from the configuration and re-entering it (once) makes everything work great.
Thanks for your patient help!
from chatfred.
Hey @kraonn!
Thanks for your message. I will look into it. Would be great if you check the script - as you mentioned. If you debug you can get the error message from OpenAI. That would help a lot.
from chatfred.
Thanks for responding. I would like to just run the script in terminal, but I cannot find where it's installed? What's the full path for the scripts that are a part of this workflow? I'm not an Alfred workflow expert so I don't know where those live.
from chatfred.
You can find the scripts in the src
folder. With a right-click on the Workflow, you can open it in the finder. If you are using ChatFred you are looking for the text_chat.py
script. In the error_handling.py
you can find your error is actually a openai.error.APIConnectionError
. Here you can read more about it.
from chatfred.
Hey @kraonn!
I could not reproduce your issue. Were you able to find out anything?
from chatfred.
Hey @cindy9923!
Thanks for your message. Looks like there is some kind of issue with NumPy.
In the openai.datalib
it says:
This module helps make data libraries like
numpy
andpandas
optional dependencies.
The libraries add up to 130MB+, which makes it challenging to deploy applications
using this library in environments with code size constraints, like AWS Lambda.
This module serves as an import proxy and provides a few utilities for dealing with the optionality.
Since the primary use case of this library (talking to the OpenAI API) doesnโt generally require data libraries,
itโs safe to make them optional. The rare case when data libraries are needed in the client is handled through
assertions with instructive error messages.
It checks for those packages:
try:
import numpy
except ImportError:
numpy = None
try:
import pandas
except ImportError:
pandas = None
And raises an error if they are needed and not existing:
def assert_has_numpy():
if not HAS_NUMPY:
raise MissingDependencyError(NUMPY_INSTRUCTIONS)
def assert_has_pandas():
if not HAS_PANDAS:
raise MissingDependencyError(PANDAS_INSTRUCTIONS)
You could try either updating them or installing OpenAI's datalib: $ pip install openai[datalib]
. Hope that helps!
from chatfred.
Still an issue for me. I installed openai but the installation command above to install the datalib dependencies fails for me, it says openai[datalib] is not found. Probably something dumb, I'm a novice with installing Python packages.
from chatfred.
Could you check if you have Pandas and NumPy installed and if so which version?
from chatfred.
If you are willing to debug. You could find out what error OpenAI is returning. As mentioned above you can check the exception_response
function in error_handling.py
maybe the original openai.error.APIConnectionError
is more helpful.
`
from chatfred.
I'm not sure how to debug that APIConnectionError error further, everything I can find suggests that it doesn't give any more specifics about the problem. The image generation script also works perfectly if I invoke it from terminal, but not when run from the Alfred workflow.
from chatfred.
Have you made any changes to the workflow's configuration? Like Maximum tokens
, Temperature
, etc.? If it works for you through the terminal maybe it is something wrong with the needed environment variables.
from chatfred.
I have not, I've only set the API key.
I rebooted into safe mode just to be sure I didn't have some network filter utility running that would be intercepting the script, but got the same behavior.
Could it be a permissions issue? Do we know what user the Alfred workflow executes under?
from chatfred.
Could it be a permissions issue? Do we know what user the Alfred workflow executes under?
Nothing I know of. ๐ค
One Idea. You could exchange the make_chat_request
function in the text_chat.py
with this:
def make_chat_request(
prompt: str,
temperature: float,
max_tokens: Optional[int],
top_p: int,
frequency_penalty: float,
presence_penalty: float,
) -> Tuple[str, str]:
handle_custom_prompts(prompt)
messages = create_message(prompt)
try:
response = (
openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=messages,
temperature=temperature,
max_tokens=max_tokens,
top_p=top_p,
frequency_penalty=frequency_penalty,
presence_penalty=presence_penalty,
)
.choices[0]
.message["content"]
)
except Exception as exception: # pylint: disable=broad-except
response = exception._message # Use OpenAI error
return prompt, response
Now it prints the original OpenAI error. Maybe this help us to figure out the problem.
from chatfred.
Great! Good to hear. Right now I am working on an error logger. So next time it should be easier to get the proper error message.
from chatfred.
Related Issues (20)
- Azure OpenAI API support? HOT 1
- Ollama support
- Notifications "You exceeded your current quota, please check your plan and billing details." instead of proper responds. HOT 3
- Gallery version is outdated HOT 1
- Do you have any plan to support DALL-E 3? HOT 3
- Constant error message: hmm something is wrong with your request, try again later... HOT 14
- Instruct GPT Models Deprecated HOT 7
- Autocomplete for aliases HOT 1
- Add support for images using GPT4-vision
- support custom model
- No response, just large ๐ฌ emoji HOT 8
- how to chat to the previous gpt reply? HOT 2
- Token overuse HOT 3
- Order when using the Universal action & combined prompts
- Use Chatfred with LocalAI server? HOT 3
- Cannot Set the history_length to 0 Despite Being Provided HOT 7
- ChatGPT Aliases Should Search for Keyword Within the Prompt, Instead of the Other Way Around HOT 1
- Ability to edit system prompt HOT 4
- Is anyone experiencing problems with inputs being cutoff? HOT 3
- Streaming the Reply to Save Time HOT 2
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 chatfred.