Spaces:
Sleeping
Sleeping
fixed variable name
Browse files
tools.py
CHANGED
|
@@ -151,7 +151,7 @@ class DescribeImageTool(Tool):
|
|
| 151 |
"""ensure, that the super class is instantiated properly and creat an OpenAI client (if not already done)."""
|
| 152 |
super().__init__()
|
| 153 |
|
| 154 |
-
if not self.
|
| 155 |
openai_api_key = os.environ.get('REAL_OPENAI_API_KEY', # just in case we run with other openAI compatibel providers
|
| 156 |
os.environ.get('OPENAI_API_KEY')
|
| 157 |
)
|
|
@@ -198,7 +198,7 @@ class DescribeImageTool(Tool):
|
|
| 198 |
prompt = self.get_prompt(description_type, custom_prompt)
|
| 199 |
|
| 200 |
# Make the API call
|
| 201 |
-
response =
|
| 202 |
model='gpt-4.1',
|
| 203 |
messages=[{'role': 'user',
|
| 204 |
'content': [{'type': 'text',
|
|
|
|
| 151 |
"""ensure, that the super class is instantiated properly and creat an OpenAI client (if not already done)."""
|
| 152 |
super().__init__()
|
| 153 |
|
| 154 |
+
if not self.__class__.client:
|
| 155 |
openai_api_key = os.environ.get('REAL_OPENAI_API_KEY', # just in case we run with other openAI compatibel providers
|
| 156 |
os.environ.get('OPENAI_API_KEY')
|
| 157 |
)
|
|
|
|
| 198 |
prompt = self.get_prompt(description_type, custom_prompt)
|
| 199 |
|
| 200 |
# Make the API call
|
| 201 |
+
response = self.__class__._client.chat.completions.create(
|
| 202 |
model='gpt-4.1',
|
| 203 |
messages=[{'role': 'user',
|
| 204 |
'content': [{'type': 'text',
|