Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
4.1 kB
6
Indexable
Never
---------------------------------------------------------------------------
RateLimitError                            Traceback (most recent call last)
Input In [4], in <cell line: 4>()
      1 prompt = f"""
      2 Pls provide steps to perform patch upgrade for Linux server
      3 """
----> 4 response = get_completion(prompt)
      5 print(response)

Input In [3], in get_completion(prompt, model)
      1 def get_completion(prompt, model="gpt-3.5-turbo"):
      2     messages = [{"role": "USER", "content": prompt}]
----> 3     response = openai.ChatCompletion.create(
      4         model=model,
      5         messages=messages,
      6         temperature=0, # this is the degree of randomness of the model's output
      7     )
      8     return response.choices[0].message["content"]

File /Analytics/venv/CAPEANALYTICS/lib/python3.8/site-packages/openai/api_resources/chat_completion.py:25, in ChatCompletion.create(cls, *args, **kwargs)
     23 while True:
     24     try:
---> 25         return super().create(*args, **kwargs)
     26     except TryAgain as e:
     27         if timeout is not None and time.time() > start + timeout:

File /Analytics/venv/CAPEANALYTICS/lib/python3.8/site-packages/openai/api_resources/abstract/engine_api_resource.py:153, in EngineAPIResource.create(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)
    127 @classmethod
    128 def create(
    129     cls,
   (...)
    136     **params,
    137 ):
    138     (
    139         deployment_id,
    140         engine,
   (...)
    150         api_key, api_base, api_type, api_version, organization, **params
    151     )
--> 153     response, _, api_key = requestor.request(
    154         "post",
    155         url,
    156         params=params,
    157         headers=headers,
    158         stream=stream,
    159         request_id=request_id,
    160         request_timeout=request_timeout,
    161     )
    163     if stream:
    164         # must be an iterator
    165         assert not isinstance(response, OpenAIResponse)

File /Analytics/venv/CAPEANALYTICS/lib/python3.8/site-packages/openai/api_requestor.py:298, in APIRequestor.request(self, method, url, params, headers, files, stream, request_id, request_timeout)
    277 def request(
    278     self,
    279     method,
   (...)
    286     request_timeout: Optional[Union[float, Tuple[float, float]]] = None,
    287 ) -> Tuple[Union[OpenAIResponse, Iterator[OpenAIResponse]], bool, str]:
    288     result = self.request_raw(
    289         method.lower(),
    290         url,
   (...)
    296         request_timeout=request_timeout,
    297     )
--> 298     resp, got_stream = self._interpret_response(result, stream)
    299     return resp, got_stream, self.api_key

File /Analytics/venv/CAPEANALYTICS/lib/python3.8/site-packages/openai/api_requestor.py:700, in APIRequestor._interpret_response(self, result, stream)
    692     return (
    693         self._interpret_response_line(
    694             line, result.status_code, result.headers, stream=True
    695         )
    696         for line in parse_stream(result.iter_lines())
    697     ), True
    698 else:
    699     return (
--> 700         self._interpret_response_line(
    701             result.content.decode("utf-8"),
    702             result.status_code,
    703             result.headers,
    704             stream=False,
    705         ),
    706         False,
    707     )

File /Analytics/venv/CAPEANALYTICS/lib/python3.8/site-packages/openai/api_requestor.py:763, in APIRequestor._interpret_response_line(self, rbody, rcode, rheaders, stream)
    761 stream_error = stream and "error" in resp.data
    762 if stream_error or not 200 <= rcode < 300:
--> 763     raise self.handle_error_response(
    764         rbody, rcode, resp.data, rheaders, stream_error=stream_error
    765     )
    766 return resp

RateLimitError: You exceeded your current quota, please check your plan and billing details.