Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_vendor_multimodal_model=True is returning "NO_CONTENT" #571

Open
Namohar opened this issue Dec 30, 2024 · 5 comments
Open

use_vendor_multimodal_model=True is returning "NO_CONTENT" #571

Namohar opened this issue Dec 30, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@Namohar
Copy link

Namohar commented Dec 30, 2024

When we use "vendor_multimodal_model=True" with Azure OpenAI, we receive a response like "NO_CONTENT." Please assist. Thank you!
Uploading image (1).png…

@Namohar Namohar added the bug Something isn't working label Dec 30, 2024
@BinaryBrain
Copy link
Member

Hi!
Can you provide the jobID and your code?

@BinaryBrain BinaryBrain self-assigned this Jan 3, 2025
@Namohar
Copy link
Author

Namohar commented Jan 4, 2025

@BinaryBrain import os
from dotenv import load_dotenv
from llama_parse import LlamaParse
from llama_index.core import SimpleDirectoryReader
import ssl

Configure SSL

ssl._create_default_https_context = ssl._create_unverified_context

Load environment variables from the .env file

load_dotenv()

Retrieve the API keys and other environment variables

LLAMA_CLOUD_API_KEY = os.getenv("LLAMA_CLOUD_API_KEY")
AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
AZURE_OPENAI_CHAT_COMPLETION_DEPLOYED_MODEL_NAME = os.getenv("AZURE_OPENAI_CHAT_COMPLETION_DEPLOYED_MODEL_NAME")
AZURE_OPENAI_API_KEY = os.getenv("AZURE_OPENAI_API_KEY")
DOWNLOAD_PATH = os.getenv("DOWNLOAD_PATH", "./data")

Check if necessary API keys are loaded correctly

if not LLAMA_CLOUD_API_KEY:
raise ValueError("LLAMA_CLOUD_API_KEY is missing. Please set it in your .env file.")
if not AZURE_OPENAI_API_KEY or not AZURE_OPENAI_ENDPOINT or not AZURE_OPENAI_CHAT_COMPLETION_DEPLOYED_MODEL_NAME:
raise ValueError("Azure OpenAI configuration is missing. Please set the required variables in your .env file.")
try:
# Initialize the LlamaParse parser
parser = LlamaParse(
api_key=LLAMA_CLOUD_API_KEY, # Pass the API key here
result_type="markdown", # "markdown" and "text" are available
use_vendor_multimodal_model=True,
# azure_openai_endpoint=AZURE_OPENAI_ENDPOINT,
azure_openai_deployment_name="gpt-4o",
azure_openai_endpoint=AZURE_OPENAI_ENDPOINT,
azure_openai_api_version="2024-10-01-preview",
azure_openai_key=AZURE_OPENAI_API_KEY,
)
except Exception as e:
print(f"An error occurred while initializing the parser: {e}")

Use SimpleDirectoryReader to parse our file

file_extractor = {".pdf": parser}
documents = SimpleDirectoryReader(input_files=[r'data/canada.pdf'], file_extractor=file_extractor).load_data()

Print the documents (parsed output)

print("Parsed documents:")
print(documents)

@BinaryBrain
Copy link
Member

BinaryBrain commented Jan 4, 2025 via email

@Namohar
Copy link
Author

Namohar commented Jan 4, 2025

@BinaryBrain Not sure on what is JobId and where to get that please.

@PBritto697
Copy link

When it's parsing it displays the jobid on terminal window and I think it can also be seen on the history tab in the playground session. Not sure about latter one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants