Find answers from the community

Home
Members
enginirmata 🐲
e
enginirmata 🐲
Offline, last seen 3 months ago
Joined September 25, 2024
'ello all! what am i doing wrong here with a function tool with a pydantic arg? is there a better way to have function tools that take typed objects as args?

Plain Text
class TestObj(BaseModel):
    id: str = Field(description="Unique identifier.")

def test_fn(obj: TestObj):
    return 1

FunctionTool.from_defaults(test_fn),


RuntimeError: no validator found for <class 'app.leader_agent.TestObj'>, see arbitrary_types_allowed in Config
5 comments
L
e
πŸ‘‹ 'ello all

how to i provide a vector store to an IngestionPipeline run that's from a StorageContext? the vector_store param on IP takes a BasePydanticVector store a storage_context.vector_store is my SimpleVectorStore. it's throwing a dict invalid error

Plain Text
IngestionPipeline(
    transformations=[...],
    docstore=storage_context.docstore, # loads/uses sc docstore
    # errors: vector_store=storage_context.vector_store
).run(documents=documents)
6 comments
e
L
'ello all πŸ‘‹ is there a way to speed-up/parallelize SimpleDirectoryReader?
4 comments
e
L
afternoon builders

i'm working to have a shared storage space amongst tools so i'm passing the same instance of a StorageContext. i'd like to persist (to the shared StorageContext) original document nodes, chunked/metadata-enhaced nodes, and indexes [over the node stores] in the ingestion tool to read them elsewhere. i'm trying to understand how the different storage objects in the context are managed

  1. ingestion tool reads files to get document nodes (manually adding these docs to docstore after getting the document nodes, since there's no storage_context arg to SimpleDirectoryReader)
  2. ingestion tool then chunks them (i'm passing a vector_store here but should i also update the docstore? will vector_stores[vector_store.name] automatically add the chunks/nodes from transformation? will it only do that if one of the transformation steps adds embeddings to each node?
  3. the ingestion tool then creates an index over the store with the chunk nodes (i've been struggling to then access this index later, should i be manually setting a new index with add_index_struct and read it later by rebuilding an index from an index struct?)
16 comments
e
L
afternoon all!

why does Document metadata have to be json serializable? thought i'd be able to handle anything during extraction steps
20 comments
e
L
Hello there! Does anyone have pointers around adding streaming support to the 'error response' agent? https://docs.llamaindex.ai/en/latest/examples/agent/custom_agent.html# I see elsewhere that OpenAIAgent supports it but I'd like to learn how to add it to a CustomSimpleAgent implementation
2 comments
L
i've upgraded to Version: 0.9.26
3 comments
L
e
hello everyone!

i'm working on adding a custom extractor to my vector query engine pipeline and looking at this notebook as reference

Plain Text
class CustomExtractor(BaseExtractor):
    def extract(self, nodes):
        metadata_list = [
            {
                "custom": (
                    node.metadata["document_title"]
                    + "\n"
                    + node.metadata["excerpt_keywords"]
                )
            }
            for node in nodes
        ]
        return metadata_list


however, i'm getting a TypeError: Can't instantiate abstract class CustomExtractor with abstract method aextract when pasting the documentation code as is

(running llama-index v 0.9.25.post1)

does anyone have pointers on writing custom extractors?
8 comments
L
e
πŸ‘‹ when using StorageContext.from_defaults(persist_dir) i get a FileNotFoundError: [Errno 2] No such file or .../docstore.json. shouldn't that be created if it doesn't exist (first time) and otherwise loaded in?
4 comments
L
e
can we pass stop_sequence to Anthropic LLM? TypeError: Messages.create() got an unexpected keyword argument 'stop_sequence'
8 comments
L
e
i'm experience the anthropic llm not using the system_prompt kwarg
Plain Text
llm = Anthropic(
  system_prompt=system_prompt


this works however when in chat
Plain Text
self.memory.put(ChatMessage(content=system_prompt, role=MessageRole.SYSTEM))
2 comments
a
L
doubling back on this: are tools supported with the Anthropic LLM?
1 comment
L
speaking of Anthropic... i just swapped out OpenAI and got TypeError: Messages.create() got an unexpected keyword argument 'tools'. is there any guidance on tool calling with llama's anthropic wrapper?
1 comment
L
the LLMCompilerAgentPack seems to have poor/no memory of the chat history/memory when running it as a repl (chat_repl). has anyone else bumped into that?
1 comment
L