lfx-nightly 0.1.13.dev1__py3-none-any.whl → 0.1.13.dev3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lfx-nightly might be problematic. Click here for more details.

Files changed (58) hide show
  1. lfx/_assets/component_index.json +1 -1
  2. lfx/base/agents/agent.py +17 -1
  3. lfx/base/agents/utils.py +15 -2
  4. lfx/base/datastax/__init__.py +5 -0
  5. lfx/{components/vectorstores/astradb.py → base/datastax/astradb_base.py} +81 -471
  6. lfx/base/mcp/util.py +30 -10
  7. lfx/components/agents/agent.py +9 -1
  8. lfx/components/datastax/__init__.py +12 -6
  9. lfx/components/datastax/{astra_assistant_manager.py → astradb_assistant_manager.py} +1 -0
  10. lfx/components/datastax/astradb_chatmemory.py +40 -0
  11. lfx/components/datastax/astradb_cql.py +5 -31
  12. lfx/components/datastax/astradb_graph.py +9 -123
  13. lfx/components/datastax/astradb_tool.py +12 -52
  14. lfx/components/datastax/astradb_vectorstore.py +133 -976
  15. lfx/components/datastax/create_assistant.py +1 -0
  16. lfx/components/datastax/create_thread.py +1 -0
  17. lfx/components/datastax/dotenv.py +1 -0
  18. lfx/components/datastax/get_assistant.py +1 -0
  19. lfx/components/datastax/getenvvar.py +1 -0
  20. lfx/components/datastax/graph_rag.py +1 -1
  21. lfx/components/datastax/list_assistants.py +1 -0
  22. lfx/components/datastax/run.py +1 -0
  23. lfx/components/input_output/chat.py +8 -0
  24. lfx/components/input_output/chat_output.py +8 -0
  25. lfx/components/knowledge_bases/ingestion.py +17 -9
  26. lfx/components/knowledge_bases/retrieval.py +16 -8
  27. lfx/components/logic/loop.py +4 -0
  28. lfx/components/vectorstores/__init__.py +0 -6
  29. lfx/field_typing/constants.py +1 -0
  30. lfx/graph/edge/base.py +2 -2
  31. {lfx_nightly-0.1.13.dev1.dist-info → lfx_nightly-0.1.13.dev3.dist-info}/METADATA +1 -1
  32. {lfx_nightly-0.1.13.dev1.dist-info → lfx_nightly-0.1.13.dev3.dist-info}/RECORD +35 -56
  33. lfx/components/datastax/astra_db.py +0 -77
  34. lfx/components/datastax/cassandra.py +0 -92
  35. lfx/components/vectorstores/astradb_graph.py +0 -326
  36. lfx/components/vectorstores/cassandra.py +0 -264
  37. lfx/components/vectorstores/cassandra_graph.py +0 -238
  38. lfx/components/vectorstores/chroma.py +0 -167
  39. lfx/components/vectorstores/clickhouse.py +0 -135
  40. lfx/components/vectorstores/couchbase.py +0 -102
  41. lfx/components/vectorstores/elasticsearch.py +0 -267
  42. lfx/components/vectorstores/faiss.py +0 -111
  43. lfx/components/vectorstores/graph_rag.py +0 -141
  44. lfx/components/vectorstores/hcd.py +0 -314
  45. lfx/components/vectorstores/milvus.py +0 -115
  46. lfx/components/vectorstores/mongodb_atlas.py +0 -213
  47. lfx/components/vectorstores/opensearch.py +0 -243
  48. lfx/components/vectorstores/pgvector.py +0 -72
  49. lfx/components/vectorstores/pinecone.py +0 -134
  50. lfx/components/vectorstores/qdrant.py +0 -109
  51. lfx/components/vectorstores/supabase.py +0 -76
  52. lfx/components/vectorstores/upstash.py +0 -124
  53. lfx/components/vectorstores/vectara.py +0 -97
  54. lfx/components/vectorstores/vectara_rag.py +0 -164
  55. lfx/components/vectorstores/weaviate.py +0 -89
  56. /lfx/components/datastax/{astra_vectorize.py → astradb_vectorize.py} +0 -0
  57. {lfx_nightly-0.1.13.dev1.dist-info → lfx_nightly-0.1.13.dev3.dist-info}/WHEEL +0 -0
  58. {lfx_nightly-0.1.13.dev1.dist-info → lfx_nightly-0.1.13.dev3.dist-info}/entry_points.txt +0 -0
lfx/base/agents/agent.py CHANGED
@@ -164,7 +164,16 @@ class LCAgentComponent(Component):
164
164
  # ! Because the input has to be a string, we must pass the images in the chat_history
165
165
 
166
166
  image_dicts = [item for item in lc_message.content if item.get("type") == "image"]
167
- lc_message.content = [item for item in lc_message.content if item.get("type") != "image"]
167
+ text_items = [item for item in lc_message.content if item.get("type") != "image"]
168
+
169
+ # Extract text content from remaining items
170
+ if text_items:
171
+ # If there are text items, extract their text content
172
+ input_text = " ".join(item.get("text", "") for item in text_items if item.get("type") == "text").strip()
173
+
174
+ # If input_text is still a list or empty, provide a default
175
+ if isinstance(input_text, list) or not input_text:
176
+ input_text = "Process the provided images."
168
177
 
169
178
  if "chat_history" not in input_dict:
170
179
  input_dict["chat_history"] = []
@@ -172,6 +181,13 @@ class LCAgentComponent(Component):
172
181
  input_dict["chat_history"].extend(HumanMessage(content=[image_dict]) for image_dict in image_dicts)
173
182
  else:
174
183
  input_dict["chat_history"] = [HumanMessage(content=[image_dict]) for image_dict in image_dicts]
184
+
185
+ # Final safety check: ensure input_text is never empty (prevents Anthropic API errors)
186
+ if not input_text or (isinstance(input_text, (list, str)) and not str(input_text).strip()):
187
+ input_text = "Continue the conversation."
188
+ # Ensure the agent input is a string
189
+ if not isinstance(input_text, str):
190
+ input_text = " ".join(map(str, input_text)) if isinstance(input_text, list) else str(input_text)
175
191
  input_dict["input"] = input_text
176
192
  if hasattr(self, "graph"):
177
193
  session_id = self.graph.session_id
lfx/base/agents/utils.py CHANGED
@@ -47,9 +47,22 @@ def data_to_messages(data: list[Data | Message]) -> list[BaseMessage]:
47
47
  data (List[Data | Message]): The data to convert.
48
48
 
49
49
  Returns:
50
- List[BaseMessage]: The data as messages.
50
+ List[BaseMessage]: The data as messages, filtering out any with empty content.
51
51
  """
52
- return [value.to_lc_message() for value in data]
52
+ messages = []
53
+ for value in data:
54
+ try:
55
+ lc_message = value.to_lc_message()
56
+ # Only add messages with non-empty content (prevents Anthropic API errors)
57
+ content = lc_message.content
58
+ if content and ((isinstance(content, str) and content.strip()) or (isinstance(content, list) and content)):
59
+ messages.append(lc_message)
60
+ else:
61
+ logger.warning("Skipping message with empty content in chat history")
62
+ except (ValueError, AttributeError) as e:
63
+ logger.warning(f"Failed to convert message to BaseMessage: {e}")
64
+ continue
65
+ return messages
53
66
 
54
67
 
55
68
  def validate_and_create_xml_agent(
@@ -0,0 +1,5 @@
1
+ from .astradb_base import AstraDBBaseComponent
2
+
3
+ __all__ = [
4
+ "AstraDBBaseComponent",
5
+ ]