Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Update documentation to use Application instances vs API instances as much as possible

davidmezzettib4b8497aae5b
diff --git a/docs/api/index.md b/docs/api/index.md
index 1611f3f9..3e6938b6 100644
--- a/docs/api/index.md
+++ b/docs/api/index.md
@@ -91,16 +91,15 @@ curl \
## Local instance
-A local API instance can be instantiated. In this case, the API runs internally, without any network connections, providing the same consolidated functionality. This enables running txtai in Python with configuration.
+A local instance can be instantiated. In this case, a txtai application runs internally, without any network connections, providing the same consolidated functionality. This enables running txtai in Python with configuration.
The configuration above can be run in Python with:
```python
-from txtai.api import API
+from txtai.app import Application
-app = API(config.yml)
-
-# Run action
+# Load and run workflow
+app = Application(config.yml)
app.workflow("sumfrench", ["https://github.com/neuml/txtai"])
```
diff --git a/docs/pipeline/audio/transcription.md b/docs/pipeline/audio/transcription.md
index ec48c2a1..9430b91d 100644
--- a/docs/pipeline/audio/transcription.md
+++ b/docs/pipeline/audio/transcription.md
@@ -42,10 +42,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("transcribe", ["path to wav file"]))
```
diff --git a/docs/pipeline/data/segmentation.md b/docs/pipeline/data/segmentation.md
index e3931a84..bda5c2ba 100644
--- a/docs/pipeline/data/segmentation.md
+++ b/docs/pipeline/data/segmentation.md
@@ -37,10 +37,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("segment", ["This is a test. And another test."]))
```
diff --git a/docs/pipeline/data/tabular.md b/docs/pipeline/data/tabular.md
index a72c14ff..1f043db4 100644
--- a/docs/pipeline/data/tabular.md
+++ b/docs/pipeline/data/tabular.md
@@ -45,10 +45,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("tabular", ["path to csv file"]))
```
diff --git a/docs/pipeline/data/textractor.md b/docs/pipeline/data/textractor.md
index 3a377caa..c05460f7 100644
--- a/docs/pipeline/data/textractor.md
+++ b/docs/pipeline/data/textractor.md
@@ -42,10 +42,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("textract", ["https://github.com/neuml/txtai"]))
```
diff --git a/docs/pipeline/image/caption.md b/docs/pipeline/image/caption.md
index dcfc2607..3aa1d513 100644
--- a/docs/pipeline/image/caption.md
+++ b/docs/pipeline/image/caption.md
@@ -42,10 +42,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("caption", ["path to image file"]))
```
diff --git a/docs/pipeline/image/imagehash.md b/docs/pipeline/image/imagehash.md
index 318d1acb..0320597d 100644
--- a/docs/pipeline/image/imagehash.md
+++ b/docs/pipeline/image/imagehash.md
@@ -36,10 +36,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("imagehash", ["path to image file"]))
```
diff --git a/docs/pipeline/image/objects.md b/docs/pipeline/image/objects.md
index 43c05d6d..b6d0768f 100644
--- a/docs/pipeline/image/objects.md
+++ b/docs/pipeline/image/objects.md
@@ -42,10 +42,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("objects", ["path to image file"]))
```
diff --git a/docs/pipeline/text/entity.md b/docs/pipeline/text/entity.md
index f0c3eaf6..96055362 100644
--- a/docs/pipeline/text/entity.md
+++ b/docs/pipeline/text/entity.md
@@ -43,10 +43,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("entity", ["Canada's last fully intact ice shelf has suddenly collapsed, forming a Manhattan-sized iceberg"]))
```
diff --git a/docs/pipeline/text/extractor.md b/docs/pipeline/text/extractor.md
index d8e104e4..e2b7980d 100644
--- a/docs/pipeline/text/extractor.md
+++ b/docs/pipeline/text/extractor.md
@@ -43,10 +43,10 @@ extractor:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.extract([{"name": "What was won", "query": "What was won",
"question", "What was won", "snippet": False}],
["Maine man wins $1M from $25 lottery ticket"]))
diff --git a/docs/pipeline/text/labels.md b/docs/pipeline/text/labels.md
index 14a284d1..0417c79b 100644
--- a/docs/pipeline/text/labels.md
+++ b/docs/pipeline/text/labels.md
@@ -46,10 +46,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("labels", ["Great news", "That's rough"]))
```
diff --git a/docs/pipeline/text/similarity.md b/docs/pipeline/text/similarity.md
index 53dbfce5..e63e2ad5 100644
--- a/docs/pipeline/text/similarity.md
+++ b/docs/pipeline/text/similarity.md
@@ -41,10 +41,10 @@ similarity:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
app.similarity("feel good story", [
"Maine man wins $1M from $25 lottery ticket",
"Don't sacrifice slower friends in a bear attack"
diff --git a/docs/pipeline/text/summary.md b/docs/pipeline/text/summary.md
index f2496d17..53abdffd 100644
--- a/docs/pipeline/text/summary.md
+++ b/docs/pipeline/text/summary.md
@@ -42,10 +42,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("summary", ["Enter long, detailed text to summarize here"]))
```
diff --git a/docs/pipeline/text/translation.md b/docs/pipeline/text/translation.md
index 288ecef7..b3499163 100644
--- a/docs/pipeline/text/translation.md
+++ b/docs/pipeline/text/translation.md
@@ -43,10 +43,10 @@ workflow:
### Run with Workflows
```python
-from txtai.api import API
+from txtai.app import Application
# Create and run pipeline with workflow
-app = API("config.yml")
+app = Application("config.yml")
list(app.workflow("translate", ["This is a test translation into Spanish"]))
```
diff --git a/docs/workflow/index.md b/docs/workflow/index.md
index aff78224..1815d0ef 100644
--- a/docs/workflow/index.md
+++ b/docs/workflow/index.md
@@ -93,10 +93,10 @@ workflow:
```python
# Create and run the workflow
-from txtai.api import API
+from txtai.app import Application
# Create and run the workflow
-app = API("workflow.yml")
+app = Application("workflow.yml")
list(app.workflow("index", [
"US_tops_5_million.wav",
"Canadas_last_fully.wav",
diff --git a/docs/workflow/schedule.md b/docs/workflow/schedule.md
index 57af23c9..1b1f2f2a 100644
--- a/docs/workflow/schedule.md
+++ b/docs/workflow/schedule.md
@@ -52,10 +52,10 @@ workflow:
```python
# Create and run the workflow
-from txtai.api import API
+from txtai.app import Application
# Create and run the workflow
-app = API("workflow.yml")
+app = Application("workflow.yml")
# Wait for scheduled workflows
app.wait()
diff --git a/examples/22_Transform_tabular_data_with_composable_workflows.ipynb b/examples/22_Transform_tabular_data_with_composable_workflows.ipynb
index 675eda3c..29c3d842 100644
--- a/examples/22_Transform_tabular_data_with_composable_workflows.ipynb
+++ b/examples/22_Transform_tabular_data_with_composable_workflows.ipynb
@@ -47,7 +47,7 @@
},
"source": [
"%%capture\n",
- "!pip install git+https://github.com/neuml/txtai#egg=txtai[api,pipeline,workflow]"
+ "!pip install git+https://github.com/neuml/txtai#egg=txtai[pipeline,workflow]"
],
"execution_count": null,
"outputs": []
@@ -832,12 +832,12 @@
"source": [
"import yaml\n",
"\n",
- "from txtai.api import API\n",
+ "from txtai.app import Application\n",
"\n",
"with open(\"workflow.yml\") as config:\n",
" workflow = yaml.safe_load(config)\n",
"\n",
- "app = API(workflow)\n",
+ "app = Application(workflow)\n",
"\n",
"# Run the workflow\n",
"data = list(app.workflow(\"index\", [\"all:aliens\"]))\n",
diff --git a/examples/26_Entity_extraction_workflows.ipynb b/examples/26_Entity_extraction_workflows.ipynb
index 15fbbed9..c1604501 100644
--- a/examples/26_Entity_extraction_workflows.ipynb
+++ b/examples/26_Entity_extraction_workflows.ipynb
@@ -63,7 +63,7 @@
},
"source": [
"%%capture\n",
- "!pip install git+https://github.com/neuml/txtai#egg=txtai[api]"
+ "!pip install git+https://github.com/neuml/txtai"
],
"execution_count": null,
"outputs": []
@@ -224,10 +224,10 @@
" - action: index\n",
"\"\"\"\n",
"\n",
- "from txtai.api import API\n",
+ "from txtai.app import Application\n",
"\n",
"# Create and run workflow\n",
- "app = API(workflow)\n",
+ "app = Application(workflow)\n",
"for _ in app.workflow(\"index\", [(x, row, None) for x, row in enumerate(data)]):\n",
" pass\n",
"\n",
diff --git a/examples/27_Workflow_scheduling.ipynb b/examples/27_Workflow_scheduling.ipynb
index b2dce2eb..aead3b0f 100644
--- a/examples/27_Workflow_scheduling.ipynb
+++ b/examples/27_Workflow_scheduling.ipynb
@@ -49,7 +49,7 @@
},
"source": [
"%%capture\n",
- "!pip install datasets git+https://github.com/neuml/txtai#egg=txtai[api,workflow]"
+ "!pip install datasets git+https://github.com/neuml/txtai#egg=txtai[workflow]"
],
"execution_count": 6,
"outputs": []
@@ -107,7 +107,7 @@
{
"cell_type": "code",
"source": [
- "from txtai.api import API\n",
+ "from txtai.app import Application\n",
"\n",
"# Run up to every 5 seconds 4 times\n",
"workflow = \"\"\"\n",
@@ -128,7 +128,7 @@
" - upsert\n",
"\"\"\"\n",
"\n",
- "app = API(workflow)\n",
+ "app = Application(workflow)\n",
"app.wait()"
],
"metadata": {
@@ -237,7 +237,7 @@
{
"cell_type": "code",
"source": [
- "from txtai.api import API\n",
+ "from txtai.app import Application\n",
"\n",
"# Run every 5 seconds up to 4 times\n",
"workflow = \"\"\"\n",
@@ -268,7 +268,7 @@
" task: console\n",
"\"\"\"\n",
"\n",
- "app = API(workflow)\n",
+ "app = Application(workflow)\n",
"app.wait()"
],
"metadata": {
diff --git a/examples/28_Push_notifications_with_workflows.ipynb b/examples/28_Push_notifications_with_workflows.ipynb
index 6b5e4b8c..88fc5fc8 100644
--- a/examples/28_Push_notifications_with_workflows.ipynb
+++ b/examples/28_Push_notifications_with_workflows.ipynb
@@ -47,7 +47,7 @@
},
"source": [
"%%capture\n",
- "!pip install datasets git+https://github.com/neuml/txtai#egg=txtai[api,pipeline,workflow]"
+ "!pip install datasets git+https://github.com/neuml/txtai#egg=txtai[pipeline,workflow]"
],
"execution_count": 1,
"outputs": []
@@ -140,7 +140,7 @@
{
"cell_type": "code",
"source": [
- "from txtai.api import API\n",
+ "from txtai.app import Application\n",
"\n",
"workflow = \"\"\"\n",
"writable: true\n",
@@ -185,7 +185,7 @@
" - action: __main__.Slack\n",
"\"\"\"\n",
"\n",
- "app = API(workflow)\n",
+ "app = Application(workflow)\n",
"app.wait()"
],
"metadata": {
@@ -239,7 +239,7 @@
{
"cell_type": "code",
"source": [
- "from txtai.api import API\n",
+ "from txtai.app import Application\n",
"\n",
"workflow = \"\"\"\n",
"writable: true\n",
@@ -285,7 +285,7 @@
" - action: __main__.Slack\n",
"\"\"\"\n",
"\n",
- "app = API(workflow)\n",
+ "app = Application(workflow)\n",
"app.wait()"
],
"metadata": {
@@ -339,7 +339,7 @@
{
"cell_type": "code",
"source": [
- "from txtai.api import API\n",
+ "from txtai.app import Application\n",
"\n",
"workflow = \"\"\"\n",
"writable: true\n",
@@ -396,7 +396,7 @@
" unpack: false\n",
"\"\"\"\n",
"\n",
- "app = API(workflow)\n",
+ "app = Application(workflow)\n",
"app.wait()"
],
"metadata": {
@@ -448,7 +448,7 @@
{
"cell_type": "code",
"source": [
- "from txtai.api import API\n",
+ "from txtai.app import Application\n",
"\n",
"workflow = \"\"\"\n",
"writable: true\n",
@@ -510,7 +510,7 @@
" unpack: false\n",
"\"\"\"\n",
"\n",
- "app = API(workflow)\n",
+ "app = Application(workflow)\n",
"app.wait()"
],
"metadata": {