We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import micropip await micropip.install('openai', keep_going=True) await micropip.install("ssl") import openai from openai import OpenAI client = OpenAI( api_key="API KEY", ) chat_completion = client.chat.completions.create( messages=[ { "role": "user", "content": "Say this is a test", } ], model="gpt-3.5-turbo", )
Running this results in the following error:
OSError Traceback (most recent call last) File /lib/python3.11/site-packages/httpcore/_exceptions.py:10, in map_exceptions(map) 9 try: ---> 10 yield 11 except Exception as exc: # noqa: PIE786 File /lib/python3.11/site-packages/httpcore/_backends/sync.py:206, in SyncBackend.connect_tcp(self, host, port, timeout, local_address, socket_options) 205 with map_exceptions(exc_map): --> 206 sock = socket.create_connection( 207 address, 208 timeout, 209 source_address=source_address, 210 ) 211 for option in socket_options: File /lib/python311.zip/socket.py:851, in create_connection(address, timeout, source_address, all_errors) 850 if not all_errors: --> 851 raise exceptions[0] 852 raise ExceptionGroup("create_connection failed", exceptions) File /lib/python311.zip/socket.py:836, in create_connection(address, timeout, source_address, all_errors) 835 sock.bind(source_address) --> 836 sock.connect(sa) 837 # Break explicitly a reference cycle OSError: [Errno 23] Host is unreachable The above exception was the direct cause of the following exception: ConnectError Traceback (most recent call last) File /lib/python3.11/site-packages/httpx/_transports/default.py:66, in map_httpcore_exceptions() 65 try: ---> 66 yield 67 except Exception as exc: File /lib/python3.11/site-packages/httpx/_transports/default.py:228, in HTTPTransport.handle_request(self, request) 227 with map_httpcore_exceptions(): --> 228 resp = self._pool.handle_request(req) 230 assert isinstance(resp.stream, typing.Iterable) File /lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:268, in ConnectionPool.handle_request(self, request) 267 self.response_closed(status) --> 268 raise exc 269 else: File /lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:251, in ConnectionPool.handle_request(self, request) 250 try: --> 251 response = connection.handle_request(request) 252 except ConnectionNotAvailable: 253 # The ConnectionNotAvailable exception is a special case, that 254 # indicates we need to retry the request on a new connection. (...) 258 # might end up as an HTTP/2 connection, but which actually ends 259 # up as HTTP/1.1. File /lib/python3.11/site-packages/httpcore/_sync/connection.py:99, in HTTPConnection.handle_request(self, request) 98 self._connect_failed = True ---> 99 raise exc 100 elif not self._connection.is_available(): File /lib/python3.11/site-packages/httpcore/_sync/connection.py:76, in HTTPConnection.handle_request(self, request) 75 try: ---> 76 stream = self._connect(request) 78 ssl_object = stream.get_extra_info("ssl_object") File /lib/python3.11/site-packages/httpcore/_sync/connection.py:124, in HTTPConnection._connect(self, request) 123 with Trace("connect_tcp", logger, request, kwargs) as trace: --> 124 stream = self._network_backend.connect_tcp(**kwargs) 125 trace.return_value = stream File /lib/python3.11/site-packages/httpcore/_backends/sync.py:205, in SyncBackend.connect_tcp(self, host, port, timeout, local_address, socket_options) 200 exc_map: ExceptionMapping = { 201 socket.timeout: ConnectTimeout, 202 OSError: ConnectError, 203 } --> 205 with map_exceptions(exc_map): 206 sock = socket.create_connection( 207 address, 208 timeout, 209 source_address=source_address, 210 ) File /lib/python311.zip/contextlib.py:155, in _GeneratorContextManager.__exit__(self, typ, value, traceback) 154 try: --> 155 self.gen.throw(typ, value, traceback) 156 except StopIteration as exc: 157 # Suppress StopIteration *unless* it's the same exception that 158 # was passed to throw(). This prevents a StopIteration 159 # raised inside the "with" statement from being suppressed. File /lib/python3.11/site-packages/httpcore/_exceptions.py:14, in map_exceptions(map) 13 if isinstance(exc, from_exc): ---> 14 raise to_exc(exc) from exc 15 raise ConnectError: [Errno 23] Host is unreachable The above exception was the direct cause of the following exception: ConnectError Traceback (most recent call last) File /lib/python3.11/site-packages/openai/_base_client.py:858, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls) 857 try: --> 858 response = self._client.send(request, auth=self.custom_auth, stream=stream) 859 log.debug( 860 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase 861 ) File /lib/python3.11/site-packages/httpx/_client.py:901, in Client.send(self, request, stream, auth, follow_redirects) 899 auth = self._build_request_auth(request, auth) --> 901 response = self._send_handling_auth( 902 request, 903 auth=auth, 904 follow_redirects=follow_redirects, 905 history=[], 906 ) 907 try: File /lib/python3.11/site-packages/httpx/_client.py:929, in Client._send_handling_auth(self, request, auth, follow_redirects, history) 928 while True: --> 929 response = self._send_handling_redirects( 930 request, 931 follow_redirects=follow_redirects, 932 history=history, 933 ) 934 try: File /lib/python3.11/site-packages/httpx/_client.py:966, in Client._send_handling_redirects(self, request, follow_redirects, history) 964 hook(request) --> 966 response = self._send_single_request(request) 967 try: File /lib/python3.11/site-packages/httpx/_client.py:1002, in Client._send_single_request(self, request) 1001 with request_context(request=request): -> 1002 response = transport.handle_request(request) 1004 assert isinstance(response.stream, SyncByteStream) File /lib/python3.11/site-packages/httpx/_transports/default.py:227, in HTTPTransport.handle_request(self, request) 215 req = httpcore.Request( 216 method=request.method, 217 url=httpcore.URL( (...) 225 extensions=request.extensions, 226 ) --> 227 with map_httpcore_exceptions(): 228 resp = self._pool.handle_request(req) File /lib/python311.zip/contextlib.py:155, in _GeneratorContextManager.__exit__(self, typ, value, traceback) 154 try: --> 155 self.gen.throw(typ, value, traceback) 156 except StopIteration as exc: 157 # Suppress StopIteration *unless* it's the same exception that 158 # was passed to throw(). This prevents a StopIteration 159 # raised inside the "with" statement from being suppressed. File /lib/python3.11/site-packages/httpx/_transports/default.py:83, in map_httpcore_exceptions() 82 message = str(exc) ---> 83 raise mapped_exc(message) from exc ConnectError: [Errno 23] Host is unreachable During handling of the above exception, another exception occurred: OSError Traceback (most recent call last) File /lib/python3.11/site-packages/httpcore/_exceptions.py:10, in map_exceptions(map) 9 try: ---> 10 yield 11 except Exception as exc: # noqa: PIE786 File /lib/python3.11/site-packages/httpcore/_backends/sync.py:206, in SyncBackend.connect_tcp(self, host, port, timeout, local_address, socket_options) 205 with map_exceptions(exc_map): --> 206 sock = socket.create_connection( 207 address, 208 timeout, 209 source_address=source_address, 210 ) 211 for option in socket_options: File /lib/python311.zip/socket.py:851, in create_connection(address, timeout, source_address, all_errors) 850 if not all_errors: --> 851 raise exceptions[0] 852 raise ExceptionGroup("create_connection failed", exceptions) File /lib/python311.zip/socket.py:836, in create_connection(address, timeout, source_address, all_errors) 835 sock.bind(source_address) --> 836 sock.connect(sa) 837 # Break explicitly a reference cycle OSError: [Errno 23] Host is unreachable The above exception was the direct cause of the following exception: ConnectError Traceback (most recent call last) File /lib/python3.11/site-packages/httpx/_transports/default.py:66, in map_httpcore_exceptions() 65 try: ---> 66 yield 67 except Exception as exc: File /lib/python3.11/site-packages/httpx/_transports/default.py:228, in HTTPTransport.handle_request(self, request) 227 with map_httpcore_exceptions(): --> 228 resp = self._pool.handle_request(req) 230 assert isinstance(resp.stream, typing.Iterable) File /lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:268, in ConnectionPool.handle_request(self, request) 267 self.response_closed(status) --> 268 raise exc 269 else: File /lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:251, in ConnectionPool.handle_request(self, request) 250 try: --> 251 response = connection.handle_request(request) 252 except ConnectionNotAvailable: 253 # The ConnectionNotAvailable exception is a special case, that 254 # indicates we need to retry the request on a new connection. (...) 258 # might end up as an HTTP/2 connection, but which actually ends 259 # up as HTTP/1.1. File /lib/python3.11/site-packages/httpcore/_sync/connection.py:99, in HTTPConnection.handle_request(self, request) 98 self._connect_failed = True ---> 99 raise exc 100 elif not self._connection.is_available(): File /lib/python3.11/site-packages/httpcore/_sync/connection.py:76, in HTTPConnection.handle_request(self, request) 75 try: ---> 76 stream = self._connect(request) 78 ssl_object = stream.get_extra_info("ssl_object") File /lib/python3.11/site-packages/httpcore/_sync/connection.py:124, in HTTPConnection._connect(self, request) 123 with Trace("connect_tcp", logger, request, kwargs) as trace: --> 124 stream = self._network_backend.connect_tcp(**kwargs) 125 trace.return_value = stream File /lib/python3.11/site-packages/httpcore/_backends/sync.py:205, in SyncBackend.connect_tcp(self, host, port, timeout, local_address, socket_options) 200 exc_map: ExceptionMapping = { 201 socket.timeout: ConnectTimeout, 202 OSError: ConnectError, 203 } --> 205 with map_exceptions(exc_map): 206 sock = socket.create_connection( 207 address, 208 timeout, 209 source_address=source_address, 210 ) File /lib/python311.zip/contextlib.py:155, in _GeneratorContextManager.__exit__(self, typ, value, traceback) 154 try: --> 155 self.gen.throw(typ, value, traceback) 156 except StopIteration as exc: 157 # Suppress StopIteration *unless* it's the same exception that 158 # was passed to throw(). This prevents a StopIteration 159 # raised inside the "with" statement from being suppressed. File /lib/python3.11/site-packages/httpcore/_exceptions.py:14, in map_exceptions(map) 13 if isinstance(exc, from_exc): ---> 14 raise to_exc(exc) from exc 15 raise ConnectError: [Errno 23] Host is unreachable The above exception was the direct cause of the following exception: ConnectError Traceback (most recent call last) File /lib/python3.11/site-packages/openai/_base_client.py:858, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls) 857 try: --> 858 response = self._client.send(request, auth=self.custom_auth, stream=stream) 859 log.debug( 860 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase 861 ) File /lib/python3.11/site-packages/httpx/_client.py:901, in Client.send(self, request, stream, auth, follow_redirects) 899 auth = self._build_request_auth(request, auth) --> 901 response = self._send_handling_auth( 902 request, 903 auth=auth, 904 follow_redirects=follow_redirects, 905 history=[], 906 ) 907 try: File /lib/python3.11/site-packages/httpx/_client.py:929, in Client._send_handling_auth(self, request, auth, follow_redirects, history) 928 while True: --> 929 response = self._send_handling_redirects( 930 request, 931 follow_redirects=follow_redirects, 932 history=history, 933 ) 934 try: File /lib/python3.11/site-packages/httpx/_client.py:966, in Client._send_handling_redirects(self, request, follow_redirects, history) 964 hook(request) --> 966 response = self._send_single_request(request) 967 try: File /lib/python3.11/site-packages/httpx/_client.py:1002, in Client._send_single_request(self, request) 1001 with request_context(request=request): -> 1002 response = transport.handle_request(request) 1004 assert isinstance(response.stream, SyncByteStream) File /lib/python3.11/site-packages/httpx/_transports/default.py:227, in HTTPTransport.handle_request(self, request) 215 req = httpcore.Request( 216 method=request.method, 217 url=httpcore.URL( (...) 225 extensions=request.extensions, 226 ) --> 227 with map_httpcore_exceptions(): 228 resp = self._pool.handle_request(req) File /lib/python311.zip/contextlib.py:155, in _GeneratorContextManager.__exit__(self, typ, value, traceback) 154 try: --> 155 self.gen.throw(typ, value, traceback) 156 except StopIteration as exc: 157 # Suppress StopIteration *unless* it's the same exception that 158 # was passed to throw(). This prevents a StopIteration 159 # raised inside the "with" statement from being suppressed. File /lib/python3.11/site-packages/httpx/_transports/default.py:83, in map_httpcore_exceptions() 82 message = str(exc) ---> 83 raise mapped_exc(message) from exc ConnectError: [Errno 23] Host is unreachable During handling of the above exception, another exception occurred: OSError Traceback (most recent call last) File /lib/python3.11/site-packages/httpcore/_exceptions.py:10, in map_exceptions(map) 9 try: ---> 10 yield 11 except Exception as exc: # noqa: PIE786 File /lib/python3.11/site-packages/httpcore/_backends/sync.py:206, in SyncBackend.connect_tcp(self, host, port, timeout, local_address, socket_options) 205 with map_exceptions(exc_map): --> 206 sock = socket.create_connection( 207 address, 208 timeout, 209 source_address=source_address, 210 ) 211 for option in socket_options: File /lib/python311.zip/socket.py:851, in create_connection(address, timeout, source_address, all_errors) 850 if not all_errors: --> 851 raise exceptions[0] 852 raise ExceptionGroup("create_connection failed", exceptions) File /lib/python311.zip/socket.py:836, in create_connection(address, timeout, source_address, all_errors) 835 sock.bind(source_address) --> 836 sock.connect(sa) 837 # Break explicitly a reference cycle OSError: [Errno 23] Host is unreachable The above exception was the direct cause of the following exception: ConnectError Traceback (most recent call last) File /lib/python3.11/site-packages/httpx/_transports/default.py:66, in map_httpcore_exceptions() 65 try: ---> 66 yield 67 except Exception as exc: File /lib/python3.11/site-packages/httpx/_transports/default.py:228, in HTTPTransport.handle_request(self, request) 227 with map_httpcore_exceptions(): --> 228 resp = self._pool.handle_request(req) 230 assert isinstance(resp.stream, typing.Iterable) File /lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:268, in ConnectionPool.handle_request(self, request) 267 self.response_closed(status) --> 268 raise exc 269 else: File /lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:251, in ConnectionPool.handle_request(self, request) 250 try: --> 251 response = connection.handle_request(request) 252 except ConnectionNotAvailable: 253 # The ConnectionNotAvailable exception is a special case, that 254 # indicates we need to retry the request on a new connection. (...) 258 # might end up as an HTTP/2 connection, but which actually ends 259 # up as HTTP/1.1. File /lib/python3.11/site-packages/httpcore/_sync/connection.py:99, in HTTPConnection.handle_request(self, request) 98 self._connect_failed = True ---> 99 raise exc 100 elif not self._connection.is_available(): File /lib/python3.11/site-packages/httpcore/_sync/connection.py:76, in HTTPConnection.handle_request(self, request) 75 try: ---> 76 stream = self._connect(request) 78 ssl_object = stream.get_extra_info("ssl_object") File /lib/python3.11/site-packages/httpcore/_sync/connection.py:124, in HTTPConnection._connect(self, request) 123 with Trace("connect_tcp", logger, request, kwargs) as trace: --> 124 stream = self._network_backend.connect_tcp(**kwargs) 125 trace.return_value = stream File /lib/python3.11/site-packages/httpcore/_backends/sync.py:205, in SyncBackend.connect_tcp(self, host, port, timeout, local_address, socket_options) 200 exc_map: ExceptionMapping = { 201 socket.timeout: ConnectTimeout, 202 OSError: ConnectError, 203 } --> 205 with map_exceptions(exc_map): 206 sock = socket.create_connection( 207 address, 208 timeout, 209 source_address=source_address, 210 ) File /lib/python311.zip/contextlib.py:155, in _GeneratorContextManager.__exit__(self, typ, value, traceback) 154 try: --> 155 self.gen.throw(typ, value, traceback) 156 except StopIteration as exc: 157 # Suppress StopIteration *unless* it's the same exception that 158 # was passed to throw(). This prevents a StopIteration 159 # raised inside the "with" statement from being suppressed. File /lib/python3.11/site-packages/httpcore/_exceptions.py:14, in map_exceptions(map) 13 if isinstance(exc, from_exc): ---> 14 raise to_exc(exc) from exc 15 raise ConnectError: [Errno 23] Host is unreachable The above exception was the direct cause of the following exception: ConnectError Traceback (most recent call last) File /lib/python3.11/site-packages/openai/_base_client.py:858, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls) 857 try: --> 858 response = self._client.send(request, auth=self.custom_auth, stream=stream) 859 log.debug( 860 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase 861 ) File /lib/python3.11/site-packages/httpx/_client.py:901, in Client.send(self, request, stream, auth, follow_redirects) 899 auth = self._build_request_auth(request, auth) --> 901 response = self._send_handling_auth( 902 request, 903 auth=auth, 904 follow_redirects=follow_redirects, 905 history=[], 906 ) 907 try: File /lib/python3.11/site-packages/httpx/_client.py:929, in Client._send_handling_auth(self, request, auth, follow_redirects, history) 928 while True: --> 929 response = self._send_handling_redirects( 930 request, 931 follow_redirects=follow_redirects, 932 history=history, 933 ) 934 try: File /lib/python3.11/site-packages/httpx/_client.py:966, in Client._send_handling_redirects(self, request, follow_redirects, history) 964 hook(request) --> 966 response = self._send_single_request(request) 967 try: File /lib/python3.11/site-packages/httpx/_client.py:1002, in Client._send_single_request(self, request) 1001 with request_context(request=request): -> 1002 response = transport.handle_request(request) 1004 assert isinstance(response.stream, SyncByteStream) File /lib/python3.11/site-packages/httpx/_transports/default.py:227, in HTTPTransport.handle_request(self, request) 215 req = httpcore.Request( 216 method=request.method, 217 url=httpcore.URL( (...) 225 extensions=request.extensions, 226 ) --> 227 with map_httpcore_exceptions(): 228 resp = self._pool.handle_request(req) File /lib/python311.zip/contextlib.py:155, in _GeneratorContextManager.__exit__(self, typ, value, traceback) 154 try: --> 155 self.gen.throw(typ, value, traceback) 156 except StopIteration as exc: 157 # Suppress StopIteration *unless* it's the same exception that 158 # was passed to throw(). This prevents a StopIteration 159 # raised inside the "with" statement from being suppressed. File /lib/python3.11/site-packages/httpx/_transports/default.py:83, in map_httpcore_exceptions() 82 message = str(exc) ---> 83 raise mapped_exc(message) from exc ConnectError: [Errno 23] Host is unreachable The above exception was the direct cause of the following exception: APIConnectionError Traceback (most recent call last) Cell In[7], line 11 5 from openai import OpenAI 7 client = OpenAI( 8 api_key="API KEY", 9 ) ---> 11 chat_completion = client.chat.completions.create( 12 messages=[ 13 { 14 "role": "user", 15 "content": "Say this is a test", 16 } 17 ], 18 model="gpt-3.5-turbo", 19 ) File /lib/python3.11/site-packages/openai/_utils/_utils.py:299, in required_args.<locals>.inner.<locals>.wrapper(*args, **kwargs) 297 msg = f"Missing required argument: {quote(missing[0])}" 298 raise TypeError(msg) --> 299 return func(*args, **kwargs) File /lib/python3.11/site-packages/openai/resources/chat/completions.py:594, in Completions.create(self, messages, model, frequency_penalty, function_call, functions, logit_bias, max_tokens, n, presence_penalty, response_format, seed, stop, stream, temperature, tool_choice, tools, top_p, user, extra_headers, extra_query, extra_body, timeout) 548 @required_args(["messages", "model"], ["messages", "model", "stream"]) 549 def create( 550 self, (...) 592 timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, 593 ) -> ChatCompletion | Stream[ChatCompletionChunk]: --> 594 return self._post( 595 "/chat/completions", 596 body=maybe_transform( 597 { 598 "messages": messages, 599 "model": model, 600 "frequency_penalty": frequency_penalty, 601 "function_call": function_call, 602 "functions": functions, 603 "logit_bias": logit_bias, 604 "max_tokens": max_tokens, 605 "n": n, 606 "presence_penalty": presence_penalty, 607 "response_format": response_format, 608 "seed": seed, 609 "stop": stop, 610 "stream": stream, 611 "temperature": temperature, 612 "tool_choice": tool_choice, 613 "tools": tools, 614 "top_p": top_p, 615 "user": user, 616 }, 617 completion_create_params.CompletionCreateParams, 618 ), 619 options=make_request_options( 620 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout 621 ), 622 cast_to=ChatCompletion, 623 stream=stream or False, 624 stream_cls=Stream[ChatCompletionChunk], 625 ) File /lib/python3.11/site-packages/openai/_base_client.py:1055, in SyncAPIClient.post(self, path, cast_to, body, options, files, stream, stream_cls) 1041 def post( 1042 self, 1043 path: str, (...) 1050 stream_cls: type[_StreamT] | None = None, 1051 ) -> ResponseT | _StreamT: 1052 opts = FinalRequestOptions.construct( 1053 method="post", url=path, json_data=body, files=to_httpx_files(files), **options 1054 ) -> 1055 return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File /lib/python3.11/site-packages/openai/_base_client.py:834, in SyncAPIClient.request(self, cast_to, options, remaining_retries, stream, stream_cls) 825 def request( 826 self, 827 cast_to: Type[ResponseT], (...) 832 stream_cls: type[_StreamT] | None = None, 833 ) -> ResponseT | _StreamT: --> 834 return self._request( 835 cast_to=cast_to, 836 options=options, 837 stream=stream, 838 stream_cls=stream_cls, 839 remaining_retries=remaining_retries, 840 ) File /lib/python3.11/site-packages/openai/_base_client.py:890, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls) 888 except Exception as err: 889 if retries > 0: --> 890 return self._retry_request( 891 options, 892 cast_to, 893 retries, 894 stream=stream, 895 stream_cls=stream_cls, 896 ) 897 raise APIConnectionError(request=request) from err 899 return self._process_response( 900 cast_to=cast_to, 901 options=options, (...) 904 stream_cls=stream_cls, 905 ) File /lib/python3.11/site-packages/openai/_base_client.py:925, in SyncAPIClient._retry_request(self, options, cast_to, remaining_retries, response_headers, stream, stream_cls) 921 # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a 922 # different thread if necessary. 923 time.sleep(timeout) --> 925 return self._request( 926 options=options, 927 cast_to=cast_to, 928 remaining_retries=remaining, 929 stream=stream, 930 stream_cls=stream_cls, 931 ) File /lib/python3.11/site-packages/openai/_base_client.py:890, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls) 888 except Exception as err: 889 if retries > 0: --> 890 return self._retry_request( 891 options, 892 cast_to, 893 retries, 894 stream=stream, 895 stream_cls=stream_cls, 896 ) 897 raise APIConnectionError(request=request) from err 899 return self._process_response( 900 cast_to=cast_to, 901 options=options, (...) 904 stream_cls=stream_cls, 905 ) File /lib/python3.11/site-packages/openai/_base_client.py:925, in SyncAPIClient._retry_request(self, options, cast_to, remaining_retries, response_headers, stream, stream_cls) 921 # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a 922 # different thread if necessary. 923 time.sleep(timeout) --> 925 return self._request( 926 options=options, 927 cast_to=cast_to, 928 remaining_retries=remaining, 929 stream=stream, 930 stream_cls=stream_cls, 931 ) File /lib/python3.11/site-packages/openai/_base_client.py:897, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls) 889 if retries > 0: 890 return self._retry_request( 891 options, 892 cast_to, (...) 895 stream_cls=stream_cls, 896 ) --> 897 raise APIConnectionError(request=request) from err 899 return self._process_response( 900 cast_to=cast_to, 901 options=options, (...) 904 stream_cls=stream_cls, 905 ) APIConnectionError: Connection error.
Is there any possible way to support openai to run in Pyodide?
Also, mentioning pyodide/pyodide#4292 for other possible solutions to work with the library on Pyodide.
No response
The text was updated successfully, but these errors were encountered:
Opened an updated version of the issue: #960
Sorry, something went wrong.
jiter
pyodide
chore(internal): move client class to separate file (#815)
d0b915a
No branches or pull requests
Confirm this is a feature request for the Python library and not the underlying OpenAI API.
Describe the feature or improvement you're requesting
Running this results in the following error:
Is there any possible way to support openai to run in Pyodide?
Also, mentioning pyodide/pyodide#4292 for other possible solutions to work with the library on Pyodide.
Additional context
No response
The text was updated successfully, but these errors were encountered: