Skip to content

Commit

Permalink
community[patch]: OpenLLM Async Client Fixes and Timeout Parameter (#…
Browse files Browse the repository at this point in the history
…20007)

Same changes as this merged
[PR](#17478)
(#17478), but for the
async client, as the same issues persist.

- Replaced 'responses' attribute of OpenLLM's GenerationOutput schema to
'outputs'.
reference:
https://github.com/bentoml/OpenLLM/blob/66de54eae7e420a3740ddd77862fd7f7b7d8a222/openllm-core/src/openllm_core/_schemas.py#L135

- Added timeout parameter for the async client.

---------

Co-authored-by: Seray Arslan <seray.arslan@knime.com>
  • Loading branch information
charlod and Seray Arslan committed Apr 9, 2024
1 parent 37a9e23 commit add31f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libs/community/langchain_community/llms/openllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,12 @@ async def _acall(
self._identifying_params["model_name"], **copied
)
if self._client:
async_client = openllm.client.AsyncHTTPClient(self.server_url)
async_client = openllm.client.AsyncHTTPClient(self.server_url, self.timeout)
res = (
await async_client.generate(prompt, **config.model_dump(flatten=True))
).responses[0]
(await async_client.generate(prompt, **config.model_dump(flatten=True)))
.outputs[0]
.text
)
else:
assert self._runner is not None
(
Expand Down

0 comments on commit add31f4

Please sign in to comment.