Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] API Error: status_code: 401, body: unauthorized #385

Open
yoyohoho0221 opened this issue Jan 26, 2025 · 0 comments
Open

[BUG] API Error: status_code: 401, body: unauthorized #385

yoyohoho0221 opened this issue Jan 26, 2025 · 0 comments

Comments

@yoyohoho0221
Copy link

Hi there, first of all thanks for checking this issue, I have recently tried to deploy zep community locally, however I have the API Error raised. I have generated the API secret and API key with JWT.

Could anyone help me resolve it? Thanks a lot!

The error is:
Exception has occurred: ApiError
status_code: 401, body: unauthorized
StopIteration: 0

During handling of the above exception, another exception occurred:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

File "C:\Users\yaoyao14\Downloads\zep.py", line 29, in
client.memory.add(
zep_python.core.api_error.ApiError: status_code: 401, body: unauthorized

The log of zep shows:
zep-1 | 2025-01-26T03:03:32.767ZINFOHTTP Request Served{"proto": "HTTP/1.1", "method": "POST", "path": "/api/v2/sessions/1db9280c30ca4e938516f21b619a6988/memory", "request_id": "", "duration": "119.237µs", "status": 401, "response_size": 13}

My testing code is very simple.

client = Zep(
api_key=API_KEY,
base_url=BASE_URL,
)

sessionId = uuid.uuid4().hex
client.memory.add(
session_id=sessionId,
messages=[
Message(
content="content",
role_type="norole",
)
],
)

The code to generate secret and API key:
import secrets
import jwt
sec=secrets.token_urlsafe(64)
print(sec)
playload={}
token = jwt.encode(playload, sec, algorithm='HS256')
print(token)

Environment (please complete the following information):

  • Zep version: latest
  • Zep SDK and version: zep-python latest
  • Deployment using docker compose following the online guide.
@yoyohoho0221 yoyohoho0221 changed the title [BUG] API Error: [BUG] API Error: status_code: 401, body: unauthorized Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant