Skip to content

Commit

Permalink
finish docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkells committed Oct 21, 2024
1 parent 1e057c9 commit 86c3b9f
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 739 deletions.
17 changes: 17 additions & 0 deletions docs/reference/pipeline/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ This document provides an overview of the integration components available in th
2. [HuggingFaceComponent](#huggingfacecomponent)
3. [LangChainComponent](#langchaincomponent)

## Installation Requirements
Before utilizing the integration components, it is important to note that the required third-party libraries are not included in HealthChain's default installation. This design decision was made to:

- Maintain a lean and flexible core package
- Allow users to selectively install only the necessary dependencies
- Avoid potential version conflicts with other packages in your environment

To use these integrations, you will need to manually install the corresponding libraries using pip.

```python
pip install spacy
python -m spacy download en_core_web_sm # or another desired model
pip install transformers
pip install langchain
```


## SpacyComponent

The `SpacyComponent` allows you to integrate spaCy models into your HealthChain pipeline. To initialize the component it only requires the path to the Spacy pipeline you wish to use. To run this example you may need to first run `python -m spacy download en_core_web_sm` to download the model.
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/pipeline/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ pipeline.add(RemoveStopwords(stopwords))

[(BaseComponent API Reference)](../../api/component.md#healthchain.pipeline.components.basecomponent.BaseComponent)

### Integrations

HealthChain offers powerful integrations with popular NLP libraries, enhancing its capabilities and allowing you to build more sophisticated pipelines. These integrations include components for spaCy, Hugging Face Transformers, and LangChain, enabling you to leverage state-of-the-art NLP models and techniques within your HealthChain workflows.

Integrations are covered in detail on the [Integration](./integrations.md) homepage.

## Pipeline Management 🔨

#### Adding
Expand Down
7 changes: 1 addition & 6 deletions healthchain/pipeline/components/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ def __call__(self, doc: Document) -> Document:

class HuggingFaceComponent(BaseComponent[str]):
def __init__(self, task, model):
try:
from transformers import pipeline
except ImportError:
raise ImportError(
"Transformers is not installed. Install it with 'pip install healthchain[transformers]'"
)
from transformers import pipeline

nlp = pipeline(task=task, model=model)
self.nlp = nlp
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ nav:
- Overview: reference/pipeline/pipeline.md
- Data Container: reference/pipeline/data_container.md
- Component: reference/pipeline/component.md
- Integrations: reference/pipeline/integrations.md
- Models:
- Overview: reference/pipeline/models/models.md
- Prebuilt:
Expand Down
Loading

0 comments on commit 86c3b9f

Please sign in to comment.