You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experimenting with the GoT framework, but I keep encountering an AttributeError.
There's an error when running the example files i.e. doc_merg.py, keyword_counting.py, set_intersection.py files, and sorting.py files. Error is traced back to chatgpt.py. It's strange that this error is present ONLY when running the example files, but it doesn't show up when running the quick start prompt.
Code:
from openai import OpenAI, OpenAIError
@backoff.on_exception(backoff.expo, OpenAIError, max_time=10, max_tries=6)
def chat(self, messages: List[Dict], num_responses: int = 1) -> ChatCompletion:
"""
Send chat messages to the OpenAI model and retrieves the model's response.
Implements backoff on OpenAI error.
:param messages: A list of message dictionaries for the chat.
:type messages: List[Dict]
:param num_responses: Number of desired responses, default is 1.
:type num_responses: int
:return: The OpenAI model's response.
:rtype: ChatCompletion
"""
response = self.client.chat.completions.create(
model=self.model_id,
messages=messages,
temperature=self.temperature,
max_tokens=self.max_tokens,
n=num_responses,
stop=self.stop,
)
self.prompt_tokens += response.usage.prompt_tokens
self.completion_tokens += response.usage.completion_tokens
prompt_tokens_k = float(self.prompt_tokens) / 1000.0
completion_tokens_k = float(self.completion_tokens) / 1000.0
self.cost = (
self.prompt_token_cost * prompt_tokens_k
+ self.response_token_cost * completion_tokens_k
)
self.logger.info(
f"This is the response from chatgpt: {response}"
f"\nThis is the cost of the response: {self.cost}"
)
return response
The error message:
line 104, in ChatGPT
backoff.expo, openai.error.OpenAIError, max_time=10, max_tries=6
^^^^^^^^^^^^
AttributeError: module 'openai' has no attribute 'error'
This is preventing me from running any example file including my own. Any suggestions?
The text was updated successfully, but these errors were encountered:
Okay, so I've managed to solve this issue. All I had to do was move the graph_of_thoughts directory inside my project directory for my custom project to work. Additionally, relocating the 'graph_of_thoughts' directory into the respective example directories within the repository resolves the issue, enabling smooth execution of the example files.
Hi,
I'm experimenting with the GoT framework, but I keep encountering an AttributeError.
There's an error when running the example files i.e. doc_merg.py, keyword_counting.py, set_intersection.py files, and sorting.py files. Error is traced back to chatgpt.py. It's strange that this error is present ONLY when running the example files, but it doesn't show up when running the quick start prompt.
Code:
The error message:
This is preventing me from running any example file including my own. Any suggestions?
The text was updated successfully, but these errors were encountered: