Spaces:
Paused
Paused
Update crew.py
Browse files
crew.py
CHANGED
|
@@ -11,7 +11,7 @@ from google import genai
|
|
| 11 |
from google.genai import types
|
| 12 |
from openinference.instrumentation.crewai import CrewAIInstrumentor
|
| 13 |
from phoenix.otel import register
|
| 14 |
-
from util import read_file
|
| 15 |
|
| 16 |
## LLMs
|
| 17 |
|
|
@@ -169,8 +169,11 @@ def run_crew(question, file_path):
|
|
| 169 |
RuntimeError: If processing fails"""
|
| 170 |
try:
|
| 171 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 172 |
-
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
response = client.models.generate_content(
|
| 176 |
model=DOCUMENT_ANALYSIS_MODEL,
|
|
|
|
| 11 |
from google.genai import types
|
| 12 |
from openinference.instrumentation.crewai import CrewAIInstrumentor
|
| 13 |
from phoenix.otel import register
|
| 14 |
+
from util import read_file, read_docx, is_ext
|
| 15 |
|
| 16 |
## LLMs
|
| 17 |
|
|
|
|
| 169 |
RuntimeError: If processing fails"""
|
| 170 |
try:
|
| 171 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 172 |
+
|
| 173 |
+
if is_ext(file_path, "docx")
|
| 174 |
+
xxx = read_docx(file_path)
|
| 175 |
+
else:
|
| 176 |
+
file = client.files.upload(file=file_path)
|
| 177 |
|
| 178 |
response = client.models.generate_content(
|
| 179 |
model=DOCUMENT_ANALYSIS_MODEL,
|