Commit
•
458d448
1
Parent(s):
b90d63a
Update crewai/tools/clarifai_tools.py
Browse files
crewai/tools/clarifai_tools.py
CHANGED
@@ -13,7 +13,13 @@ import json
|
|
13 |
import os
|
14 |
from google.api_core import exceptions
|
15 |
|
|
|
|
|
16 |
PAT = os.getenv('CLARIFAI_PAT')
|
|
|
|
|
|
|
|
|
17 |
|
18 |
# Ensure the API key is available
|
19 |
if not PAT:
|
@@ -26,11 +32,15 @@ from langchain.tools import tool
|
|
26 |
class ClarifaiTools():
|
27 |
@tool("Clarifai Image Tool")
|
28 |
def clarifai_image(prompt):
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
34 |
|
35 |
# Clarifai gRPC setup
|
36 |
channel = ClarifaiChannel.get_grpc_channel()
|
|
|
13 |
import os
|
14 |
from google.api_core import exceptions
|
15 |
|
16 |
+
#Constants
|
17 |
+
|
18 |
PAT = os.getenv('CLARIFAI_PAT')
|
19 |
+
USER_ID = 'openai'
|
20 |
+
APP_ID = 'dall-e'
|
21 |
+
MODEL_ID = 'dall-e-3'
|
22 |
+
MODEL_VERSION_ID = 'dc9dcb6ee67543cebc0b9a025861b868'
|
23 |
|
24 |
# Ensure the API key is available
|
25 |
if not PAT:
|
|
|
32 |
class ClarifaiTools():
|
33 |
@tool("Clarifai Image Tool")
|
34 |
def clarifai_image(prompt):
|
35 |
+
|
36 |
+
"""
|
37 |
+
Searches for content based on the provided query using the Gemini model.
|
38 |
+
Handles DeadlineExceeded exceptions from the Google API.
|
39 |
+
Args:
|
40 |
+
query (str): The search query.
|
41 |
+
Returns:
|
42 |
+
str: The response text from the Gemini model or an error message.
|
43 |
+
"""
|
44 |
|
45 |
# Clarifai gRPC setup
|
46 |
channel = ClarifaiChannel.get_grpc_channel()
|