openai.beta.assistants.list() not working
Closed this issue · 1 comments
CakeCrusher commented
@louis030195 (needed for GPT)
Replicate:
from openai import OpenAI
openai = OpenAI(
base_url="http://localhost:3000",
api_key="EMPTY"
)
openai.beta.assistants.list()
Error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[5], [line 1](vscode-notebook-cell:?execution_count=5&line=1)
----> [1](vscode-notebook-cell:?execution_count=5&line=1) openai.beta.assistants.list()
File [c:\Projects\assistants-api\.venv\lib\site-packages\openai\resources\beta\assistants\assistants.py:272](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:272), in Assistants.list(self, after, before, limit, order, extra_headers, extra_query, extra_body, timeout)
[242](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:242) """Returns a list of assistants.
[243](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:243)
[244](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:244) Args:
(...)
[269](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:269) timeout: Override the client-level default timeout for this request, in seconds
[270](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:270) """
[271](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:271) extra_headers = {"OpenAI-Beta": "assistants=v1", **(extra_headers or {})}
--> [272](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:272) return self._get_api_list(
[273](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:273) "/assistants",
[274](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:274) page=SyncCursorPage[Assistant],
[275](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:275) options=make_request_options(
[276](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:276) extra_headers=extra_headers,
[277](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:277) extra_query=extra_query,
[278](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:278) extra_body=extra_body,
[279](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:279) timeout=timeout,
[280](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:280) query=maybe_transform(
[281](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:281) {
[282](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:282) "after": after,
[283](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:283) "before": before,
[284](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:284) "limit": limit,
[285](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:285) "order": order,
[286](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:286) },
[287](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:287) assistant_list_params.AssistantListParams,
[288](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:288) ),
[289](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:289) ),
[290](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:290) model=Assistant,
[291](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/resources/beta/assistants/assistants.py:291) )
File [c:\Projects\assistants-api\.venv\lib\site-packages\openai\_base_client.py:1138](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:1138), in SyncAPIClient.get_api_list(self, path, model, page, body, options, method)
[1127](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:1127) def get_api_list(
[1128](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:1128) self,
[1129](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:1129) path: str,
(...)
[1135](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:1135) method: str = "get",
[1136](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:1136) ) -> SyncPageT:
[1137](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:1137) opts = FinalRequestOptions.construct(method=method, url=path, json_data=body, **options)
-> [1138](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:1138) return self._request_api_list(model, page, opts)
File [c:\Projects\assistants-api\.venv\lib\site-packages\openai\_base_client.py:983](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:983), in SyncAPIClient._request_api_list(self, model, page, options)
[979](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:979) return resp
[981](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:981) options.post_parser = _parser
--> [983](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:983) return self.request(page, options, stream=False)
File [c:\Projects\assistants-api\.venv\lib\site-packages\openai\_base_client.py:854](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:854), in SyncAPIClient.request(self, cast_to, options, remaining_retries, stream, stream_cls)
[845](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:845) def request(
[846](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:846) self,
[847](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:847) cast_to: Type[ResponseT],
(...)
[852](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:852) stream_cls: type[_StreamT] | None = None,
[853](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:853) ) -> ResponseT | _StreamT:
--> [854](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:854) return self._request(
[855](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:855) cast_to=cast_to,
[856](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:856) options=options,
[857](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:857) stream=stream,
[858](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:858) stream_cls=stream_cls,
[859](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:859) remaining_retries=remaining_retries,
[860](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:860) )
File [c:\Projects\assistants-api\.venv\lib\site-packages\openai\_base_client.py:933](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:933), in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls)
[929](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:929) err.response.read()
[931](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:931) raise self._make_status_error_from_response(err.response) from None
--> [933](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:933) return self._process_response(
[934](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:934) cast_to=cast_to,
[935](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:935) options=options,
[936](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:936) response=response,
[937](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:937) stream=stream,
[938](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:938) stream_cls=stream_cls,
[939](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:939) )
File [c:\Projects\assistants-api\.venv\lib\site-packages\openai\_base_client.py:519](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:519), in BaseClient._process_response(self, cast_to, options, response, stream, stream_cls)
[516](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:516) if response.request.headers.get(RAW_RESPONSE_HEADER) == "true":
[517](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:517) return cast(ResponseT, api_response)
--> [519](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:519) return api_response.parse()
File [c:\Projects\assistants-api\.venv\lib\site-packages\openai\_response.py:63](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_response.py:63), in APIResponse.parse(self)
[61](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_response.py:61) parsed = self._parse()
[62](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_response.py:62) if is_given(self._options.post_parser):
---> [63](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_response.py:63) parsed = self._options.post_parser(parsed)
[65](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_response.py:65) self._parsed = parsed
[66](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_response.py:66) return parsed
File [c:\Projects\assistants-api\.venv\lib\site-packages\openai\_base_client.py:974](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:974), in SyncAPIClient._request_api_list.<locals>._parser(resp)
[973](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:973) def _parser(resp: SyncPageT) -> SyncPageT:
--> [974](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:974) resp._set_private_attributes(
[975](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:975) client=self,
[976](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:976) model=model,
[977](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:977) options=options,
[978](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:978) )
[979](file:///C:/Projects/assistants-api/.venv/lib/site-packages/openai/_base_client.py:979) return resp
AttributeError: 'list' object has no attribute '_set_private_attributes'
louis030195 commented
@CakeCrusher lmk if my changes fixed the issue