Closed Nkurayijahubert closed 1 month ago
@Nkurayijahubert Hello there! I'm here to help you with any bugs, questions, or contributions. Let's get to the bottom of this together.
To resolve the error "Request invalid: field 'command.name' value null
not valid. Problem: must not be null." when trying to build a component for Astra DB, you need to ensure that the command.name
field is not null. This typically means that the name
field for the component is missing or not set in your flow JSON.
Here is an example of how you can set the name
field for the component:
{
"template": {
"_type": "Component",
"name": "your_component_name", // Ensure this field is set
"chunk_size": {
"advanced": true,
"display_name": "Chunk Size",
"dynamic": false,
"info": "",
"list": false,
"name": "chunk_size",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"type": "int",
"value": 1000
},
"client": {
"advanced": true,
"display_name": "Client",
"dynamic": false,
"info": "",
"input_types": [
"Message",
"str"
],
"list": false,
"load_from_db": false,
"name": "client",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"type": "str",
"value": ""
},
// ... other fields ...
}
}
Make sure to replace "your_component_name"
with the actual name you want to give to your component. This should resolve the error by ensuring that the command.name
field is not null [1].
To continue talking to Dosu, mention @dosu.
@dosu do I have to add it manually?
Yes, you will need to manually add the name
field to your flow JSON for the Astra DB component. Ensure that each component in your JSON has a valid name
field set to avoid the error. If you have multiple components, verify that each one has a unique and non-null name
field. This should resolve the issue you're encountering.
To continue talking to Dosu, mention @dosu.
@dosu There many places with "template": {}
To ensure the command.name
field is not null, you need to add the name
field within the template
object of the specific component causing the issue. For the Astra DB component, it should look something like this:
{
"template": {
"_type": "Component",
"name": "AstraDBComponent", // Add this line
"chunk_size": {
"advanced": true,
"display_name": "Chunk Size",
"dynamic": false,
"info": "",
"list": false,
"name": "chunk_size",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"type": "int",
"value": 1000
},
"client": {
"advanced": true,
"display_name": "Client",
"dynamic": false,
"info": "",
"input_types": [
"Message",
"str"
],
"list": false,
"load_from_db": false,
"name": "client",
"placeholder": "",
"required": false,
"show": true,
"title_case": false,
"type": "str",
"value": ""
}
// ... other fields ...
}
}
Make sure to add the "name": "AstraDBComponent"
line within the template
object of the Astra DB component. If you have multiple components, ensure each one has a unique and non-null name
field within their respective template
objects [1].
To continue talking to Dosu, mention @dosu.
@dosu the error persist
Ensure that the name
field is correctly set for each component in your flow JSON. Here is a more detailed example for the Astra DB component:
{
"template": {
"_type": "Component",
"name": "AstraDBComponent", // Ensure this field is set
"collection_name": {
"display_name": "Collection Name",
"info": "The name of the collection within Astra DB where the vectors will be stored.",
"type": "str",
"value": ""
},
"token": {
"display_name": "Astra DB Application Token",
"info": "Authentication token for accessing Astra DB.",
"type": "str",
"value": "ASTRA_DB_APPLICATION_TOKEN"
},
"api_endpoint": {
"display_name": "API Endpoint",
"info": "API endpoint URL for the Astra DB service.",
"type": "str",
"value": "ASTRA_DB_API_ENDPOINT"
},
"vector_store_inputs": {
"display_name": "Vector Store Inputs",
"type": "list",
"value": []
},
"embedding": {
"display_name": "Embedding",
"type": "dict",
"value": {}
},
"namespace": {
"display_name": "Namespace",
"info": "Optional namespace within Astra DB to use for the collection.",
"type": "str",
"value": ""
},
"metric": {
"display_name": "Metric",
"info": "Optional distance metric for vector comparisons in the vector store.",
"type": "str",
"options": ["cosine", "dot_product", "euclidean"],
"value": "cosine"
},
"batch_size": {
"display_name": "Batch Size",
"info": "Optional number of data to process in a single batch.",
"type": "int",
"value": 100
},
"bulk_insert_batch_concurrency": {
"display_name": "Bulk Insert Batch Concurrency",
"info": "Optional concurrency level for bulk insert operations.",
"type": "int",
"value": 5
},
"bulk_insert_overwrite_concurrency": {
"display_name": "Bulk Insert Overwrite Concurrency",
"info": "Optional concurrency level for bulk insert operations that overwrite existing data.",
"type": "int",
"value": 5
},
"bulk_delete_concurrency": {
"display_name": "Bulk Delete Concurrency",
"info": "Optional concurrency level for bulk delete operations.",
"type": "int",
"value": 5
},
"setup_mode": {
"display_name": "Setup Mode",
"info": "Configuration mode for setting up the vector store, with options like 'Sync', 'Async', or 'Off'.",
"type": "str",
"options": ["Sync", "Async", "Off"],
"value": "Sync"
},
"pre_delete_collection": {
"display_name": "Pre Delete Collection",
"info": "Boolean flag to determine whether to delete the collection before creating a new one.",
"type": "bool",
"value": false
},
"metadata_indexing_include": {
"display_name": "Metadata Indexing Include",
"info": "Optional list of metadata fields to include in the indexing.",
"type": "str",
"value": ""
},
"metadata_indexing_exclude": {
"display_name": "Metadata Indexing Exclude",
"info": "Optional list of metadata fields to exclude from the indexing.",
"type": "str",
"value": ""
},
"collection_indexing_policy": {
"display_name": "Collection Indexing Policy",
"info": "Optional dictionary defining the indexing policy for the collection.",
"type": "str",
"value": ""
},
"add_to_vector_store": {
"display_name": "Add to Vector Store",
"info": "If true, the Vector Store Inputs will be added to the Vector Store.",
"type": "bool",
"value": true
},
"search_input": {
"display_name": "Search Input",
"type": "str",
"value": ""
},
"search_type": {
"display_name": "Search Type",
"type": "str",
"options": ["Similarity", "MMR"],
"value": "Similarity"
},
"number_of_results": {
"display_name": "Number of Results",
"info": "Number of results to return.",
"type": "int",
"value": 4
}
}
}
Ensure that the name
field is set to a non-null value for the Astra DB component and any other components in your JSON. This should resolve the error [1].
To continue talking to Dosu, mention @dosu.
Hi @Nkurayijahubert, can you please share the exact steps you took?
I just tested that I was able to export the Vector Store RAG
example and run it locally on my machine via the run_flow_from_json
function. Attached is the json I used, and the code to run it. Plmk if that works for you, then we can figure out if anything is different in your environment.
from langflow.load import run_flow_from_json
TWEAKS = {
"ChatInput-iaJtf": {},
"AstraVectorStoreComponent-rd8LL": {
"token": "<insert token>",
"api_endpoint": "<insert endpoint>"
},
"ParseData-aybR0": {},
"Prompt-jCJmL": {},
"ChatOutput-JP4os": {},
"SplitText-CQxrN": {},
"File-IlhlA": {},
"AstraVectorStoreComponent-7hUKp": {},
"OpenAIEmbeddings-l7Jz2": {},
"OpenAIEmbeddings-6YrUm": {},
"OpenAIModel-W43IT": {}
}
# and I just exported `OPENAI_API_KEY` in the terminal I was running this from
result = run_flow_from_json(flow="test_rag.json",
input_value="message",
fallback_to_env_vars=True, # False by default
tweaks=TWEAKS)
print(result)
Hi @jordanrfrazier these are the steps I am taking:
flow_file = "vector_store.json"
TWEAKS = { "File-x63LT": {}, "SplitText-fRVmN": {}, "OpenAIEmbeddings-rU5oN": { "openai_api_key": os.getenv("OPENAI_API_KEY"), }, "AstraDB-305Eo": { "api_endpoint": os.getenv("ASTRA_DB_API_ENDPOINT"), "token": os.getenv("ASTRA_DB_APPLICATION_TOKEN"), }, "ChatInput-bLV8x": {}, "ParseData-7oE65": {}, "Prompt-z6UsK": {}, "Memory-re2mi": {}, "OpenAIModel-ul65C": { "api_key": os.getenv("OPENAI_API_KEY"), }, "ChatOutput-4YOYF": {}, }
flow = run_flow_from_json(flow=flow_file, input_value="Hello, what is the capital of France?", fallback_to_env_vars=True, # False by default tweaks=TWEAKS)
@Nkurayijahubert can you please attach your flow json file here, and I'll try running and debugging on my end tomorrow
Here it is @jordanrfrazier
Hi @Nkurayijahubert sorry for the late response. I was able to download and run your given JSON file, though I did re-upload the flow into a locally running langflow in order to verify the ID's of the components were correct for the TWEAKS.
Can you please try to
TWEAKS
component IDs are correct, taken from the </> API
button hey @Nkurayijahubert Do you need any assistance with this case? If not, please let us know if this issue can be closed.
@Nkurayijahubert Thank you for your contribution! This issue will be closed. If you have any questions or encounter another problem, please open a new issue and we will be ready to assist you.
Bug Description
This error is happening when I export the flow JSON trying to run it on my application.
Reproduction
from langflow.load import run_flow_from_json TWEAKS = { "ChatInput-UuJgn": {}, "AstraVectorStoreComponent-2mwWS": {}, "ParseData-M3W6Z": {}, "Prompt-dt6pd": {}, "ChatOutput-R5l9b": {}, "SplitText-PbqQD": {}, "File-N0Za6": {}, "OpenAIModel-LYQTz": {}, "Memory-u45lJ": {}, "OpenAIEmbeddings-ZAXxT": {} }
result = run_flow_from_json(flow="Vector_Store_RAG.json", input_value="message", fallback_to_env_vars=True, # False by default tweaks=TWEAKS)
Expected behavior
I would expect to run the flow in my Django external application.
Who can help?
No response
Operating System
Macbook Sonoma 14.2
Langflow Version
1.0.14
Python Version
3.10
Screenshot
No response
Flow File
No response