test: Unit tests illustrating Llama2 and Dolly2 invocations #1943
GitHub Actions / Production Test Results
failed
Oct 12, 2023 in 0s
343 tests run, 340 passed, 1 skipped, 2 failed.
Annotations
Check failure on line 261 in tests/steamship_tests/data/test_block.py
github-actions / Production Test Results
test_block.test_block_has_request_id
assert is not failed. [pytest-clarity diff shown]
#x1B[0m
#x1B[0m#x1B[32mLHS#x1B[0m vs #x1B[31mRHS#x1B[0m shown below
#x1B[0m
#x1B[0mNone
#x1B[0m
Raw output
client = Steamship(config=Configuration(api_key=SecretStr('**********'), api_base=AnyHttpUrl('https://api.steamship.com/api/v1/...kspace_id='819DDFE5-E73C-428D-8CFE-9F7B0D852CE5', workspace_handle='test_bz7xl7wwoh', profile='test', request_id=None))
@pytest.mark.usefixtures("client")
def test_block_has_request_id(client: Steamship):
file = File.create(client, blocks=[])
block = Block.create(client, file_id=file.id, mime_type=MimeTypes.TXT, text="foo")
> assert block.request_id is not None
E assert is not failed. [pytest-clarity diff shown]
E #x1B[0m
E #x1B[0m#x1B[32mLHS#x1B[0m vs #x1B[31mRHS#x1B[0m shown below
E #x1B[0m
E #x1B[0mNone
E #x1B[0m
tests/steamship_tests/data/test_block.py:261: AssertionError
Check failure on line 19 in tests/steamship_tests/integrations/test_google_image_search.py
github-actions / Production 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:1131)')))
Raw output
client = Steamship(config=Configuration(api_key=SecretStr('**********'), api_base=AnyHttpUrl('https://api.steamship.com/api/v1/...kspace_id='017A827F-90C9-4D94-9050-265FC072B020', workspace_handle='test_fqznwpnpbf', 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.steamship.com/api/v1/...kspace_id='017A827F-90C9-4D94-9050-265FC072B020', workspace_handle='test_fqznwpnpbf', profile='test', request_id=None))
verb = <Verb.POST: 'POST'>, operation = 'task/status'
payload = TaskStatusRequest(task_id='BFCB0231-00A4-4240-B339-2D84608CC68F')
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:1131)')))
src/steamship/base/client.py:537: SteamshipError
Loading