> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# From Directory • AI Agent SDK

> from_directory: Auto-detect and load .praisonignore from directory.

# from\_directory

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**IgnoreMatcher**](../classes/IgnoreMatcher) class in the [**indexing**](../modules/indexing) module.

Auto-detect and load .praisonignore from directory.

Also checks for .gitignore as fallback.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def from_directory(directory: str) -> 'IgnoreMatcher'
```

## Parameters

<ParamField query="directory" type="str" required={true}>
  Directory to search
</ParamField>

### Returns

<ResponseField name="Returns" type="'IgnoreMatcher'">
  IgnoreMatcher with loaded patterns
</ResponseField>

## Uses

* `exists`
* `splitlines`
* `f.read`
* `cls`

## Used By

* [`Knowledge.index`](../functions/Knowledge-index)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/knowledge/indexing.py#L291">
  `praisonaiagents/knowledge/indexing.py` at line 291
</Card>
