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

Python client implementation #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

slush0
Copy link

@slush0 slush0 commented Feb 13, 2023

Hi there, I've implemented simple Python client. Feel free to merge it if you find it useful.

@slush0
Copy link
Author

slush0 commented Feb 19, 2023

Please do NOT merge if you want to merge #9. After merging #9, I'll add support for stop generation into API.

@borzunov borzunov force-pushed the main branch 2 times, most recently from 5333dfa to 3cdc76d Compare July 19, 2023 16:12
@Sharpz7
Copy link

Sharpz7 commented Jul 31, 2023

This is great! Thank you :))

Maybe we can add it to an examples folder?

"max_length": max_length,
}
self.ws.send(json.dumps(payload))
assert json.loads(self.ws.recv())['ok'] == True
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert json.loads(self.ws.recv())['ok'] == True
assert json.loads(self.ws.recv())['ok'] is True

while True:
data = json.loads(self.ws.recv())
if not data['ok']:
raise Exception(data['traceback'])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a more specific exception here.

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

Successfully merging this pull request may close these issues.

2 participants