add dynamic clients for all APIs (#348)

* add dynamic clients for all APIs

* fix openapi generator

* inference + memory + agents tests now pass with "remote" providers

* Add docstring which fixes openapi generator :/
This commit is contained in:
Ashwin Bharambe 2024-10-31 14:46:25 -07:00 committed by GitHub
parent f04b566c5c
commit 37b330b4ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 350 additions and 84 deletions

View file

@ -315,7 +315,20 @@ def get_endpoint_operations(
)
else:
event_type = None
response_type = return_type
def process_type(t):
if typing.get_origin(t) is collections.abc.AsyncIterator:
# NOTE(ashwin): this is SSE and there is no way to represent it. either we make it a List
# or the item type. I am choosing it to be the latter
args = typing.get_args(t)
return args[0]
elif typing.get_origin(t) is typing.Union:
types = [process_type(a) for a in typing.get_args(t)]
return typing._UnionGenericAlias(typing.Union, tuple(types))
else:
return t
response_type = process_type(return_type)
# set HTTP request method based on type of request and presence of payload
if not request_params: