Open rsdrahat opened 1 month ago
Hey @rsdrahat! 👋 I'm here to assist you with any bugs, questions, or contributions you have while we wait for a human maintainer. Let's squash those bugs together!
To resolve the 500 Internal Server Error when trying to create a new schema for LlamaExtract using the Python library, ensure that the function you are passing to create_schema_from_function
is correctly defined and that all required parameters are properly annotated. Additionally, verify that any additional fields provided are in the correct format.
Here is an example of how you can use the create_schema_from_function
function correctly:
from llama_index.legacy.tools.utils import create_schema_from_function
from typing import Any
# Define a sample function with proper annotations
def sample_function(param1: int, param2: str = "default") -> Any:
pass
# Create the schema from the function
schema = create_schema_from_function("SampleSchema", sample_function)
# Optionally, you can add additional fields
additional_fields = [
("extra_field1", int, 42),
("extra_field2", str)
]
# Create the schema with additional fields
schema_with_additional_fields = create_schema_from_function("SampleSchemaWithExtras", sample_function, additional_fields)
Ensure that:
sample_function
has all parameters annotated.The create_schema_from_function
function processes the function's parameters and any additional fields to create a schema. If the error persists, it might be due to an issue with the server configuration or the way the schema is being used in the server context, which would require further investigation [1][2].
To continue talking to Dosu, mention @dosu.
Bug Description
Was working before. But now when trying to create a new schema for llamaextract, I get a 500 error using the python library.
Version
llama-index-core 0.10.59
Steps to Reproduce
Just run the below code with a valid API key in the .env file:
Relevant Logs/Tracbacks