Skip to content

Commit 795bebc

Browse files
authored
feat: Multimodal Node (#16962)
* clean gitignore * first draft * fix python versioning and typing * fix typing * make embedding storage more flexible * test mimetype guessing * add pants build file to the new package * add unit tests * add unit tests * use the right config value * better get/set_content * try * revert * pants explicit dependency * fix tests * try * fix one more test * do not load path, same as url * oops.. * try
1 parent eccda3a commit 795bebc

File tree

18 files changed

+600
-77
lines changed

18 files changed

+600
-77
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
# Build
12
.pants.d/
23
dist/
34
migration_scripts/
4-
venv/
5+
6+
# IDEs
57
.idea
8+
.vscode
9+
.zed
10+
11+
# Local development
12+
venv/
613
.venv/
714
.ipynb_checkpoints
815
.__pycache__
916
__pycache__
1017
dev_notebooks/
18+
19+
# Other
1120
llamaindex_registry.txt
1221
packages_to_bump_deduped.txt
1322
.env

.pre-commit-config.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,22 @@ repos:
2222
exclude: llama-index-core/llama_index/core/_static
2323
- id: trailing-whitespace
2424
exclude: llama-index-core/llama_index/core/_static
25+
2526
- repo: https://github.com/charliermarsh/ruff-pre-commit
2627
rev: v0.1.5
27-
2828
hooks:
2929
- id: ruff
3030
args: [--fix, --exit-non-zero-on-fix]
3131
exclude: ".*poetry.lock|.*_static"
32+
3233
- repo: https://github.com/psf/black-pre-commit-mirror
3334
rev: 23.10.1
3435
hooks:
3536
- id: black-jupyter
3637
name: black-src
3738
alias: black
3839
exclude: "^docs|.*poetry.lock|.*_static"
40+
3941
- repo: https://github.com/pre-commit/mirrors-mypy
4042
rev: v1.0.1
4143
hooks:
@@ -56,9 +58,10 @@ repos:
5658
--explicit-package-bases,
5759
--disallow-untyped-defs,
5860
--ignore-missing-imports,
59-
--python-version=3.8,
61+
--python-version=3.9,
6062
]
6163
entry: bash -c "export MYPYPATH=llama_index"
64+
6265
- repo: https://github.com/psf/black-pre-commit-mirror
6366
rev: 23.10.1
6467
hooks:
@@ -68,6 +71,7 @@ repos:
6871
files: ^(docs/|examples/)
6972
# Using PEP 8's line length in docs prevents excess left/right scrolling
7073
args: [--line-length=79]
74+
7175
- repo: https://github.com/adamchainz/blacken-docs
7276
rev: 1.16.0
7377
hooks:
@@ -78,11 +82,13 @@ repos:
7882
additional_dependencies: [black==23.10.1]
7983
# Using PEP 8's line length in docs prevents excess left/right scrolling
8084
args: [--line-length=79]
85+
8186
- repo: https://github.com/pre-commit/mirrors-prettier
8287
rev: v3.0.3
8388
hooks:
8489
- id: prettier
8590
exclude: llama-index-core/llama_index/core/_static|poetry.lock|llama-index-legacy/llama_index/legacy/_static|docs/docs
91+
8692
- repo: https://github.com/codespell-project/codespell
8793
rev: v2.2.6
8894
hooks:
@@ -98,13 +104,15 @@ repos:
98104
[
99105
"--skip=*/algolia.js",
100106
"--ignore-words-list",
101-
"astroid,gallary,momento,narl,ot,rouge,nin,gere,asend",
107+
"astroid,gallary,momento,narl,ot,rouge,nin,gere,asend,seperator",
102108
]
109+
103110
- repo: https://github.com/srstevenson/nb-clean
104111
rev: 3.1.0
105112
hooks:
106113
- id: nb-clean
107114
args: [--preserve-cell-outputs, --remove-empty-cells]
115+
108116
- repo: https://github.com/pappasam/toml-sort
109117
rev: v0.23.1
110118
hooks:

llama-index-core/llama_index/core/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
from logging import NullHandler
77
from typing import Callable, Optional
88

9+
try:
10+
# Force pants to install eval_type_backport on 3.9
11+
import eval_type_backport # noqa # type: ignore
12+
except ImportError:
13+
pass
14+
915
# response
1016
from llama_index.core.base.response.schema import Response
1117

@@ -28,8 +34,8 @@
2834
GPTVectorStoreIndex,
2935
KeywordTableIndex,
3036
KnowledgeGraphIndex,
31-
PropertyGraphIndex,
3237
ListIndex,
38+
PropertyGraphIndex,
3339
RAKEKeywordTableIndex,
3440
SimpleKeywordTableIndex,
3541
SummaryIndex,
@@ -67,6 +73,9 @@
6773
set_global_service_context,
6874
)
6975

76+
# global settings
77+
from llama_index.core.settings import Settings
78+
7079
# storage
7180
from llama_index.core.storage.storage_context import StorageContext
7281

@@ -76,9 +85,6 @@
7685
# global tokenizer
7786
from llama_index.core.utils import get_tokenizer, set_global_tokenizer
7887

79-
# global settings
80-
from llama_index.core.settings import Settings
81-
8288
# best practices for library logging:
8389
# https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
8490
logging.getLogger(__name__).addHandler(NullHandler())

llama-index-core/llama_index/core/bridge/pydantic.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
import pydantic
22
from pydantic import (
3-
ConfigDict,
3+
AnyUrl,
44
BaseModel,
5-
GetJsonSchemaHandler,
6-
GetCoreSchemaHandler,
5+
BeforeValidator,
6+
ConfigDict,
77
Field,
8+
GetCoreSchemaHandler,
9+
GetJsonSchemaHandler,
810
PlainSerializer,
911
PrivateAttr,
12+
Secret,
13+
SecretStr,
14+
SerializeAsAny,
1015
StrictFloat,
1116
StrictInt,
1217
StrictStr,
13-
create_model,
14-
model_validator,
15-
field_validator,
16-
ValidationInfo,
17-
ValidationError,
1818
TypeAdapter,
19+
ValidationError,
20+
ValidationInfo,
1921
WithJsonSchema,
20-
BeforeValidator,
21-
SerializeAsAny,
2222
WrapSerializer,
23+
create_model,
2324
field_serializer,
24-
Secret,
25-
SecretStr,
25+
field_validator,
2626
model_serializer,
27+
model_validator,
2728
)
2829
from pydantic.fields import FieldInfo
2930
from pydantic.json_schema import JsonSchemaValue
@@ -58,4 +59,5 @@
5859
"Secret",
5960
"SecretStr",
6061
"model_serializer",
62+
"AnyUrl",
6163
]

0 commit comments

Comments
 (0)