llama-index-llms-openai 0.3.38__tar.gz → 0.3.39__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- llama_index_llms_openai-0.3.39/.gitignore +153 -0
- {llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/PKG-INFO +7 -13
- {llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/llama_index/llms/openai/utils.py +9 -0
- llama_index_llms_openai-0.3.39/pyproject.toml +69 -0
- llama_index_llms_openai-0.3.38/pyproject.toml +0 -68
- {llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/LICENSE +0 -0
- {llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/README.md +0 -0
- {llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/llama_index/llms/openai/__init__.py +0 -0
- {llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/llama_index/llms/openai/base.py +0 -0
- {llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/llama_index/llms/openai/py.typed +0 -0
- {llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/llama_index/llms/openai/responses.py +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
llama_index/_static
|
|
2
|
+
.DS_Store
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
bin/
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
etc/
|
|
21
|
+
include/
|
|
22
|
+
lib/
|
|
23
|
+
lib64/
|
|
24
|
+
parts/
|
|
25
|
+
sdist/
|
|
26
|
+
share/
|
|
27
|
+
var/
|
|
28
|
+
wheels/
|
|
29
|
+
pip-wheel-metadata/
|
|
30
|
+
share/python-wheels/
|
|
31
|
+
*.egg-info/
|
|
32
|
+
.installed.cfg
|
|
33
|
+
*.egg
|
|
34
|
+
MANIFEST
|
|
35
|
+
|
|
36
|
+
# PyInstaller
|
|
37
|
+
# Usually these files are written by a python script from a template
|
|
38
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
39
|
+
*.manifest
|
|
40
|
+
*.spec
|
|
41
|
+
|
|
42
|
+
# Installer logs
|
|
43
|
+
pip-log.txt
|
|
44
|
+
pip-delete-this-directory.txt
|
|
45
|
+
|
|
46
|
+
# Unit test / coverage reports
|
|
47
|
+
htmlcov/
|
|
48
|
+
.tox/
|
|
49
|
+
.nox/
|
|
50
|
+
.coverage
|
|
51
|
+
.coverage.*
|
|
52
|
+
.cache
|
|
53
|
+
nosetests.xml
|
|
54
|
+
coverage.xml
|
|
55
|
+
*.cover
|
|
56
|
+
*.py,cover
|
|
57
|
+
.hypothesis/
|
|
58
|
+
.pytest_cache/
|
|
59
|
+
.ruff_cache
|
|
60
|
+
|
|
61
|
+
# Translations
|
|
62
|
+
*.mo
|
|
63
|
+
*.pot
|
|
64
|
+
|
|
65
|
+
# Django stuff:
|
|
66
|
+
*.log
|
|
67
|
+
local_settings.py
|
|
68
|
+
db.sqlite3
|
|
69
|
+
db.sqlite3-journal
|
|
70
|
+
|
|
71
|
+
# Flask stuff:
|
|
72
|
+
instance/
|
|
73
|
+
.webassets-cache
|
|
74
|
+
|
|
75
|
+
# Scrapy stuff:
|
|
76
|
+
.scrapy
|
|
77
|
+
|
|
78
|
+
# Sphinx documentation
|
|
79
|
+
docs/_build/
|
|
80
|
+
|
|
81
|
+
# PyBuilder
|
|
82
|
+
target/
|
|
83
|
+
|
|
84
|
+
# Jupyter Notebook
|
|
85
|
+
.ipynb_checkpoints
|
|
86
|
+
notebooks/
|
|
87
|
+
|
|
88
|
+
# IPython
|
|
89
|
+
profile_default/
|
|
90
|
+
ipython_config.py
|
|
91
|
+
|
|
92
|
+
# pyenv
|
|
93
|
+
.python-version
|
|
94
|
+
|
|
95
|
+
# pipenv
|
|
96
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
97
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
98
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
99
|
+
# install all needed dependencies.
|
|
100
|
+
#Pipfile.lock
|
|
101
|
+
|
|
102
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
103
|
+
__pypackages__/
|
|
104
|
+
|
|
105
|
+
# Celery stuff
|
|
106
|
+
celerybeat-schedule
|
|
107
|
+
celerybeat.pid
|
|
108
|
+
|
|
109
|
+
# SageMath parsed files
|
|
110
|
+
*.sage.py
|
|
111
|
+
|
|
112
|
+
# Environments
|
|
113
|
+
.env
|
|
114
|
+
.venv
|
|
115
|
+
env/
|
|
116
|
+
venv/
|
|
117
|
+
ENV/
|
|
118
|
+
env.bak/
|
|
119
|
+
venv.bak/
|
|
120
|
+
pyvenv.cfg
|
|
121
|
+
|
|
122
|
+
# Spyder project settings
|
|
123
|
+
.spyderproject
|
|
124
|
+
.spyproject
|
|
125
|
+
|
|
126
|
+
# Rope project settings
|
|
127
|
+
.ropeproject
|
|
128
|
+
|
|
129
|
+
# mkdocs documentation
|
|
130
|
+
/site
|
|
131
|
+
|
|
132
|
+
# mypy
|
|
133
|
+
.mypy_cache/
|
|
134
|
+
.dmypy.json
|
|
135
|
+
dmypy.json
|
|
136
|
+
|
|
137
|
+
# Pyre type checker
|
|
138
|
+
.pyre/
|
|
139
|
+
|
|
140
|
+
# Jetbrains
|
|
141
|
+
.idea
|
|
142
|
+
modules/
|
|
143
|
+
*.swp
|
|
144
|
+
|
|
145
|
+
# VsCode
|
|
146
|
+
.vscode
|
|
147
|
+
|
|
148
|
+
# pipenv
|
|
149
|
+
Pipfile
|
|
150
|
+
Pipfile.lock
|
|
151
|
+
|
|
152
|
+
# pyright
|
|
153
|
+
pyrightconfig.json
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: llama-index-llms-openai
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.39
|
|
4
4
|
Summary: llama-index llms openai integration
|
|
5
|
-
License: MIT
|
|
6
5
|
Author: llama-index
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Requires-Dist: llama-index-core (>=0.12.17,<0.13.0)
|
|
15
|
-
Requires-Dist: openai (>=1.66.3,<2.0.0)
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: <4.0,>=3.9
|
|
9
|
+
Requires-Dist: llama-index-core<0.13,>=0.12.36
|
|
10
|
+
Requires-Dist: openai<2,>=1.66.3
|
|
16
11
|
Description-Content-Type: text/markdown
|
|
17
12
|
|
|
18
13
|
# LlamaIndex Llms Integration: Openai
|
|
@@ -146,4 +141,3 @@ print(resp)
|
|
|
146
141
|
### LLM Implementation example
|
|
147
142
|
|
|
148
143
|
https://docs.llamaindex.ai/en/stable/examples/llm/openai/
|
|
149
|
-
|
{llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/llama_index/llms/openai/utils.py
RENAMED
|
@@ -28,6 +28,7 @@ from llama_index.core.base.llms.types import (
|
|
|
28
28
|
MessageRole,
|
|
29
29
|
TextBlock,
|
|
30
30
|
AudioBlock,
|
|
31
|
+
DocumentBlock,
|
|
31
32
|
)
|
|
32
33
|
from llama_index.core.bridge.pydantic import BaseModel
|
|
33
34
|
|
|
@@ -308,6 +309,14 @@ def to_openai_message_dict(
|
|
|
308
309
|
if isinstance(block, TextBlock):
|
|
309
310
|
content.append({"type": "text", "text": block.text})
|
|
310
311
|
content_txt += block.text
|
|
312
|
+
elif isinstance(block, DocumentBlock):
|
|
313
|
+
if not block.data:
|
|
314
|
+
file_buffer = block.resolve_document()
|
|
315
|
+
b64_string = block._get_b64_string(data_buffer=file_buffer)
|
|
316
|
+
else:
|
|
317
|
+
b64_string = block.data.decode("utf-8")
|
|
318
|
+
mimetype = block.document_mimetype if block.document_mimetype is not None else "application/pdf"
|
|
319
|
+
content.append({"type": "input_file", "filename": block.title, "file_data": f"data:{mimetype};base64,{b64_string}"})
|
|
311
320
|
elif isinstance(block, ImageBlock):
|
|
312
321
|
if block.url:
|
|
313
322
|
content.append(
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[dependency-groups]
|
|
6
|
+
dev = [
|
|
7
|
+
"ipython==8.10.0",
|
|
8
|
+
"jupyter>=1.0.0,<2",
|
|
9
|
+
"mypy==0.991",
|
|
10
|
+
"pre-commit==3.2.0",
|
|
11
|
+
"pylint==2.15.10",
|
|
12
|
+
"pytest==7.2.1",
|
|
13
|
+
"pytest-asyncio==0.21.0",
|
|
14
|
+
"pytest-mock==3.11.1",
|
|
15
|
+
"ruff==0.0.292",
|
|
16
|
+
"types-Deprecated>=0.1.0",
|
|
17
|
+
"types-PyYAML>=6.0.12.12,<7",
|
|
18
|
+
"types-protobuf>=4.24.0.4,<5",
|
|
19
|
+
"types-redis==4.5.5.0",
|
|
20
|
+
"types-requests==2.28.11.8",
|
|
21
|
+
"types-setuptools==67.1.0.0",
|
|
22
|
+
"black[jupyter]<=23.9.1,>=23.7.0",
|
|
23
|
+
"codespell[toml]>=v2.2.6",
|
|
24
|
+
"diff-cover>=9.2.0",
|
|
25
|
+
"pytest-cov>=6.1.1",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project]
|
|
29
|
+
name = "llama-index-llms-openai"
|
|
30
|
+
version = "0.3.39"
|
|
31
|
+
description = "llama-index llms openai integration"
|
|
32
|
+
authors = [{name = "llama-index"}]
|
|
33
|
+
requires-python = ">=3.9,<4.0"
|
|
34
|
+
readme = "README.md"
|
|
35
|
+
license = "MIT"
|
|
36
|
+
dependencies = [
|
|
37
|
+
"openai>=1.66.3,<2",
|
|
38
|
+
"llama-index-core>=0.12.36,<0.13",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[tool.codespell]
|
|
42
|
+
check-filenames = true
|
|
43
|
+
check-hidden = true
|
|
44
|
+
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.sdist]
|
|
47
|
+
include = ["llama_index/"]
|
|
48
|
+
exclude = ["**/BUILD"]
|
|
49
|
+
|
|
50
|
+
[tool.hatch.build.targets.wheel]
|
|
51
|
+
include = ["llama_index/"]
|
|
52
|
+
exclude = ["**/BUILD"]
|
|
53
|
+
|
|
54
|
+
[tool.llamahub]
|
|
55
|
+
contains_example = false
|
|
56
|
+
import_path = "llama_index.llms.openai"
|
|
57
|
+
|
|
58
|
+
[tool.llamahub.class_authors]
|
|
59
|
+
OpenAI = "llama-index"
|
|
60
|
+
OpenAIResponses = "llama-index"
|
|
61
|
+
|
|
62
|
+
[tool.mypy]
|
|
63
|
+
disallow_untyped_defs = true
|
|
64
|
+
exclude = ["_static", "build", "examples", "notebooks", "venv"]
|
|
65
|
+
ignore_missing_imports = true
|
|
66
|
+
python_version = "3.8"
|
|
67
|
+
|
|
68
|
+
[tool.ruff.lint.flake8-pytest-style]
|
|
69
|
+
fixture-parentheses = true
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
build-backend = "poetry.core.masonry.api"
|
|
3
|
-
requires = ["poetry-core"]
|
|
4
|
-
|
|
5
|
-
[tool.codespell]
|
|
6
|
-
check-filenames = true
|
|
7
|
-
check-hidden = true
|
|
8
|
-
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
|
|
9
|
-
|
|
10
|
-
[tool.llamahub]
|
|
11
|
-
contains_example = false
|
|
12
|
-
import_path = "llama_index.llms.openai"
|
|
13
|
-
|
|
14
|
-
[tool.llamahub.class_authors]
|
|
15
|
-
OpenAI = "llama-index"
|
|
16
|
-
OpenAIResponses = "llama-index"
|
|
17
|
-
|
|
18
|
-
[tool.mypy]
|
|
19
|
-
disallow_untyped_defs = true
|
|
20
|
-
exclude = ["_static", "build", "examples", "notebooks", "venv"]
|
|
21
|
-
ignore_missing_imports = true
|
|
22
|
-
python_version = "3.8"
|
|
23
|
-
|
|
24
|
-
[tool.poetry]
|
|
25
|
-
authors = ["llama-index"]
|
|
26
|
-
description = "llama-index llms openai integration"
|
|
27
|
-
exclude = ["**/BUILD"]
|
|
28
|
-
license = "MIT"
|
|
29
|
-
name = "llama-index-llms-openai"
|
|
30
|
-
readme = "README.md"
|
|
31
|
-
version = "0.3.38"
|
|
32
|
-
|
|
33
|
-
[tool.poetry.dependencies]
|
|
34
|
-
python = ">=3.9,<4.0"
|
|
35
|
-
openai = "^1.66.3"
|
|
36
|
-
llama-index-core = "^0.12.17"
|
|
37
|
-
|
|
38
|
-
[tool.poetry.group.dev.dependencies]
|
|
39
|
-
ipython = "8.10.0"
|
|
40
|
-
jupyter = "^1.0.0"
|
|
41
|
-
mypy = "0.991"
|
|
42
|
-
pre-commit = "3.2.0"
|
|
43
|
-
pylint = "2.15.10"
|
|
44
|
-
pytest = "7.2.1"
|
|
45
|
-
pytest-asyncio = "0.21.0"
|
|
46
|
-
pytest-mock = "3.11.1"
|
|
47
|
-
ruff = "0.0.292"
|
|
48
|
-
tree-sitter-languages = "^1.8.0"
|
|
49
|
-
types-Deprecated = ">=0.1.0"
|
|
50
|
-
types-PyYAML = "^6.0.12.12"
|
|
51
|
-
types-protobuf = "^4.24.0.4"
|
|
52
|
-
types-redis = "4.5.5.0"
|
|
53
|
-
types-requests = "2.28.11.8"
|
|
54
|
-
types-setuptools = "67.1.0.0"
|
|
55
|
-
|
|
56
|
-
[tool.poetry.group.dev.dependencies.black]
|
|
57
|
-
extras = ["jupyter"]
|
|
58
|
-
version = "<=23.9.1,>=23.7.0"
|
|
59
|
-
|
|
60
|
-
[tool.poetry.group.dev.dependencies.codespell]
|
|
61
|
-
extras = ["toml"]
|
|
62
|
-
version = ">=v2.2.6"
|
|
63
|
-
|
|
64
|
-
[[tool.poetry.packages]]
|
|
65
|
-
include = "llama_index/"
|
|
66
|
-
|
|
67
|
-
[tool.ruff.lint.flake8-pytest-style]
|
|
68
|
-
fixture-parentheses = true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/llama_index/llms/openai/base.py
RENAMED
|
File without changes
|
{llama_index_llms_openai-0.3.38 → llama_index_llms_openai-0.3.39}/llama_index/llms/openai/py.typed
RENAMED
|
File without changes
|
|
File without changes
|