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

Make API easier, and add prompt_dict for custom control over prompt as example of new API parameter don't need to pass #238

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

pseudotensor
Copy link
Collaborator

@pseudotensor pseudotensor commented Jun 6, 2023

Gradio uses positional args, and so constantly breaking API when add new parameters to pass to server from client. Already made it so returned object is string of dict. Now made input string of dict too, i.e.:

from gradio_client import Client
client = Client(os.getenv('HOST', "http://localhost:7860"))

# string of dict for input
kwargs = dict(instruction_nochat='Who are you?')
res = client.predict(str(dict(kwargs)), api_name='/submit_nochat_api')

# string of dict for output
response = ast.literal_eval(res)['response']
assert 'I am h2oGPT' in response or "I'm h2oGPT" in response or 'I’m h2oGPT' in response
=========================== short test summary info ============================
FAILED tests/test_manual_test.py::test_chat_context - NotImplementedError: MA...
FAILED tests/test_manual_test.py::test_upload_one_file - NotImplementedError:...
FAILED tests/test_manual_test.py::test_upload_multiple_file - NotImplementedE...
FAILED tests/test_manual_test.py::test_upload_url - NotImplementedError: MANU...
FAILED tests/test_manual_test.py::test_upload_arxiv - NotImplementedError: MA...
FAILED tests/test_manual_test.py::test_upload_pasted_text - NotImplementedErr...
FAILED tests/test_manual_test.py::test_no_db_dirs - NotImplementedError: MANU...
FAILED tests/test_manual_test.py::test_upload_unsupported_file - NotImplement...
FAILED tests/test_manual_test.py::test_upload_to_UserData_and_MyData - NotImp...
FAILED tests/test_manual_test.py::test_chat_control - NotImplementedError: MA...
FAILED tests/test_manual_test.py::test_subset_only - NotImplementedError: MAN...
FAILED tests/test_manual_test.py::test_add_new_doc - NotImplementedError: MAN...
= 8 failed, 94 passed, 27 skipped, 1 xfailed, 1 xpassed, 9 warnings in 1638.52s (0:27:18) =

…s example of new API parameter don't need to pass
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