test: Unit tests illustrating Llama2 and Dolly2 invocations #1943
GitHub Actions / Staging Test Results
failed
Oct 12, 2023 in 0s
343 tests run, 340 passed, 1 skipped, 2 failed.
Annotations
Check failure on line 12 in tests/steamship_tests/app/integration/test_e2e_mixins.py
github-actions / Staging Test Results
test_e2e_mixins.test_mixin_and_package_invocation
AssertionError
Raw output
client = Steamship(config=Configuration(api_key=SecretStr('**********'), api_base=AnyHttpUrl('https://api.staging.steamship.com...kspace_id='9080EF13-46EE-4DD0-B66B-8D2D9DB959AC', workspace_handle='test_4hb7aefpqj', profile='test', request_id=None))
@pytest.mark.usefixtures("client")
def test_mixin_and_package_invocation(client: Steamship):
demo_package_path = PACKAGES_PATH / "package_with_mixins.py"
> with deploy_package(client, demo_package_path, wait_for_init=True) as (_, _, instance):
tests/steamship_tests/app/integration/test_e2e_mixins.py:12:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/contextlib.py:135: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
client = Steamship(config=Configuration(api_key=SecretStr('**********'), api_base=AnyHttpUrl('https://api.staging.steamship.com...kspace_id='9080EF13-46EE-4DD0-B66B-8D2D9DB959AC', workspace_handle='test_4hb7aefpqj', profile='test', request_id=None))
py_path = PosixPath('/home/runner/work/python-client/python-client/tests/assets/packages/package_with_mixins.py')
version_config_template = None, instance_config = None
safe_load_handler = False, wait_for_init = True
@contextlib.contextmanager
def deploy_package(
client: Steamship,
py_path: Path,
version_config_template: Dict[str, Any] = None,
instance_config: Dict[str, Any] = None,
safe_load_handler: bool = False,
wait_for_init: bool = True,
):
package = Package.create(client)
zip_bytes = zip_deployable(py_path)
hosting_handler = "steamship.invocable.entrypoint.safe_handler" if safe_load_handler else None
version = PackageVersion.create(
client,
package_id=package.id,
filebytes=zip_bytes,
config_template=version_config_template,
hosting_handler=hosting_handler,
)
_wait_for_version(version)
package_instance = PackageInstance.create(
client,
package_id=package.id,
package_version_id=version.id,
config=instance_config,
)
assert package_instance.package_id == package.id
assert package_instance.package_version_id == version.id
_check_user(client, package_instance)
if wait_for_init:
package_instance.wait_for_init()
> assert package_instance.init_status in [
InvocableInitStatus.COMPLETE,
InvocableInitStatus.NOT_NEEDED,
]
E AssertionError
tests/steamship_tests/utils/deployables.py:153: AssertionError
Check failure on line 19 in tests/steamship_tests/integrations/test_google_image_search.py
github-actions / Staging Test Results
test_google_image_search.test_use_google_image_search
steamship.base.error.SteamshipError: [ERROR - POST /generate] HTTPSConnectionPool(host='generations.krea.ai', port=443): Max retries exceeded with url: /images/16172d9e-f15c-4702-96e7-1dc28d549b02.webp?User-Agent=Steamship+Browser+v1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1007)')))
Raw output
client = Steamship(config=Configuration(api_key=SecretStr('**********'), api_base=AnyHttpUrl('https://api.staging.steamship.com...kspace_id='8B223CA2-8EDB-49AF-BEF7-75DCA35D8711', workspace_handle='test_noshmqcqqk', profile='test', request_id=None))
@pytest.mark.usefixtures("client")
def test_use_google_image_search(client: Steamship):
> image_url = use_google_image_search(
"a cow standing in a field, majestic, 8k, award winning, best quality", client
)
tests/steamship_tests/integrations/test_google_image_search.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/steamship_tests/integrations/test_google_image_search.py:19: in use_google_image_search
task.wait() # Wait for the generation to complete.
src/steamship/base/tasks.py:268: in wait
self.refresh()
src/steamship/base/tasks.py:313: in refresh
resp = self.client.post("task/status", payload=req, expect=self.expect)
src/steamship/base/client.py:579: in post
return self.call(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Steamship(config=Configuration(api_key=SecretStr('**********'), api_base=AnyHttpUrl('https://api.staging.steamship.com...kspace_id='8B223CA2-8EDB-49AF-BEF7-75DCA35D8711', workspace_handle='test_noshmqcqqk', profile='test', request_id=None))
verb = <Verb.POST: 'POST'>, operation = 'task/status'
payload = TaskStatusRequest(task_id='C373B730-9E51-4F98-A786-A773752B55C4')
file = None
expect = <class 'steamship.data.operations.generator.GenerateResponse'>
debug = False, raw_response = False, is_package_call = False
package_owner = None, package_id = None, package_instance_id = None
as_background_task = False, wait_on_tasks = None, timeout_s = None
task_delay_ms = None
def call( # noqa: C901
self,
verb: Verb,
operation: str,
payload: Union[Request, dict, bytes] = None,
file: Any = None,
expect: Type[T] = None,
debug: bool = False,
raw_response: bool = False,
is_package_call: bool = False,
package_owner: str = None,
package_id: str = None,
package_instance_id: str = None,
as_background_task: bool = False,
wait_on_tasks: List[Union[str, Task]] = None,
timeout_s: Optional[float] = None,
task_delay_ms: Optional[int] = None,
) -> Union[
Any, Task
]: # TODO (enias): I would like to list all possible return types using interfaces instead of Any
"""Post to the Steamship API.
All responses have the format::
.. code-block:: json
{
"data": "<actual response>",
"error": {"reason": "<message>"}
} # noqa: RST203
For the Python client we return the contents of the `data` field if present, and we raise an exception
if the `error` field is filled in.
"""
# TODO (enias): Review this codebase
url = self._url(
is_package_call=is_package_call,
package_owner=package_owner,
operation=operation,
)
headers = self._headers(
is_package_call=is_package_call,
package_owner=package_owner,
package_id=package_id,
package_instance_id=package_instance_id,
as_background_task=as_background_task,
wait_on_tasks=wait_on_tasks,
task_delay_ms=task_delay_ms,
)
data = self._prepare_data(payload=payload)
logging.debug(
f"Making {verb} to {url} in workspace {self.config.workspace_handle}/{self.config.workspace_id}"
)
if verb == Verb.POST:
if file is not None:
files = self._prepare_multipart_data(data, file)
resp = self._session.post(url, files=files, headers=headers, timeout=timeout_s)
else:
if isinstance(data, bytes):
resp = self._session.post(url, data=data, headers=headers, timeout=timeout_s)
else:
resp = self._session.post(url, json=data, headers=headers, timeout=timeout_s)
elif verb == Verb.GET:
resp = self._session.get(url, params=data, headers=headers, timeout=timeout_s)
else:
raise Exception(f"Unsupported verb: {verb}")
logging.debug(f"From {verb} to {url} got HTTP {resp.status_code}")
if debug is True:
logging.debug(f"Got response {resp}")
response_data = self._response_data(resp, raw_response=raw_response)
logging.debug(f"Response JSON {response_data}")
task = None
error = None
if isinstance(response_data, dict):
if "status" in response_data:
try:
task = Task.parse_obj(
{**response_data["status"], "client": self, "expect": expect}
)
if "state" in response_data["status"]:
if response_data["status"]["state"] == "failed":
error = SteamshipError.from_dict(response_data["status"])
logging.warning(f"Client received error from server: {error}")
except TypeError as e:
# There's an edge case here -- if a Steamship package returns the JSON dictionary
#
# { "status": "status string" }
#
# Then the above handler will attempt to parse it and throw... But we don't actually want to throw
# since we don't take a strong opinion on what the response type of a package endpoint ought to be.
# It *may* choose to conform to the SteamshipResponse<T> type, but it doesn't have to.
if not is_package_call:
raise e
if task is not None and task.state == TaskState.failed:
error = task.as_error()
if "data" in response_data:
if expect is not None:
if issubclass(expect, SteamshipError):
data = expect.from_dict({**response_data["data"], "client": self})
elif issubclass(expect, BaseModel):
data = expect.parse_obj(
self._add_client_to_response(expect, response_data["data"])
)
else:
raise RuntimeError(f"obj of type {expect} does not have a from_dict method")
else:
data = response_data["data"]
if task:
task.output = data
else:
data = response_data
else:
data = response_data
if error is not None:
logging.warning(f"Client received error from server: {error}", exc_info=error)
> raise error
E steamship.base.error.SteamshipError: [ERROR - POST /generate] HTTPSConnectionPool(host='generations.krea.ai', port=443): Max retries exceeded with url: /images/16172d9e-f15c-4702-96e7-1dc28d549b02.webp?User-Agent=Steamship+Browser+v1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1007)')))
src/steamship/base/client.py:537: SteamshipError
Loading