Compare commits

...

8 Commits

Author SHA1 Message Date
Logan Markewich 0543375c4f make original height + width optional in the parse result 2025-04-27 18:25:43 -06:00
dependabot[bot] 43fbd48ab8 Bump actions/setup-python from 4 to 5 (#701)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-27 13:08:44 -06:00
dependabot[bot] 5ec66e9452 Bump actions/checkout from 3 to 4 (#700)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-27 13:08:31 -06:00
Scott Brenner 211521c82e Dependabot configuration to update actions in workflow (#698) 2025-04-27 12:52:11 -06:00
Scott Brenner 4ddaab1efb Refactor CodeQL workflow (#699)
* Refactor CodeQL workflow

* Update .github/workflows/codeql.yml
2025-04-27 12:51:56 -06:00
Neeraj Pradhan 53e5ce2e83 Bump to v0.6.16 (#697) 2025-04-25 14:39:52 -07:00
Neeraj Pradhan 9f4bd1cb64 Update to latest version of llama-cloud (#696)
update to latest version of llama-cloud
2025-04-25 14:14:49 -07:00
Logan 456863752b small enum nit for FailedPageMode (#693) 2025-04-23 21:34:26 -06:00
14 changed files with 732 additions and 705 deletions
+11
View File
@@ -0,0 +1,11 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# and
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
+2 -2
View File
@@ -21,9 +21,9 @@ jobs:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
+8 -48
View File
@@ -1,14 +1,3 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
@@ -28,54 +17,25 @@ jobs:
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
runs-on: "ubuntu-latest"
timeout-minutes: 360
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
languages: python
dependency-caching: true
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
category: "/language:python"
+2 -2
View File
@@ -18,11 +18,11 @@ jobs:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
+2 -2
View File
@@ -18,9 +18,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
+2 -2
View File
@@ -19,11 +19,11 @@ jobs:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
+11 -1
View File
@@ -1,7 +1,17 @@
from llama_cloud_services.extract.extract import (
LlamaExtract,
ExtractConfig,
ExtractionAgent,
SourceText,
ExtractTarget,
ExtractMode,
)
__all__ = ["LlamaExtract", "ExtractionAgent", "SourceText"]
__all__ = [
"LlamaExtract",
"ExtractionAgent",
"SourceText",
"ExtractConfig",
"ExtractTarget",
"ExtractMode",
]
+33 -20
View File
@@ -10,13 +10,10 @@ import httpx
from pydantic import BaseModel
from llama_cloud import (
ExtractAgent as CloudExtractAgent,
ExtractAgentCreate,
ExtractConfig,
ExtractJob,
ExtractJobCreate,
ExtractRun,
ExtractSchemaValidateRequest,
ExtractAgentUpdate,
File,
ExtractMode,
StatusEnum,
@@ -26,7 +23,11 @@ from llama_cloud import (
PaginatedExtractRunsResponse,
)
from llama_cloud.client import AsyncLlamaCloud
from llama_cloud_services.extract.utils import JSONObjectType, augment_async_errors
from llama_cloud_services.extract.utils import (
JSONObjectType,
augment_async_errors,
ExperimentalWarning,
)
from llama_index.core.schema import BaseComponent
from llama_index.core.async_utils import run_jobs
from llama_index.core.bridge.pydantic import Field, PrivateAttr
@@ -118,6 +119,25 @@ def run_in_thread(
return thread_pool.submit(run_coro).result()
def _extraction_config_warning(config: ExtractConfig) -> None:
if config.extraction_mode == ExtractMode.ACCURATE:
warnings.warn("ACCURATE extraction mode is deprecated. Using BALANCED instead.")
config.extraction_mode = ExtractMode.BALANCED
if config.use_reasoning:
warnings.warn(
"`use_reasoning` is an experimental feature. Results will be available in "
"the `extraction_metadata` field for the extraction run.",
ExperimentalWarning,
)
if config.cite_sources:
warnings.warn(
"`cite_sources` is an experimental feature. This may greatly increase the "
"size of the response, and slow down the extraction. Results will be "
"available in the `extraction_metadata` field for the extraction run.",
ExperimentalWarning,
)
class ExtractionAgent:
"""Class representing a single extraction agent with methods for extraction operations."""
@@ -178,7 +198,7 @@ class ExtractionAgent:
)
validated_schema = self._run_in_thread(
self._client.llama_extract.validate_extraction_schema(
request=ExtractSchemaValidateRequest(data_schema=processed_schema)
data_schema=processed_schema
)
)
self._data_schema = validated_schema.data_schema
@@ -189,6 +209,7 @@ class ExtractionAgent:
@config.setter
def config(self, config: ExtractConfig) -> None:
_extraction_config_warning(config)
self._config = config
def _run_in_thread(self, coro: Coroutine[Any, Any, T]) -> T:
@@ -307,10 +328,8 @@ class ExtractionAgent:
self._agent = self._run_in_thread(
self._client.llama_extract.update_extraction_agent(
extraction_agent_id=self.id,
request=ExtractAgentUpdate(
data_schema=self.data_schema,
config=self.config,
),
data_schema=self.data_schema,
config=self.config,
)
)
@@ -602,7 +621,7 @@ class LlamaExtract(BaseComponent):
httpx_timeout=httpx_timeout,
verbose=verbose,
)
self._httpx_client = httpx.AsyncClient(verify=verify, timeout=httpx_timeout)
self._httpx_client = httpx.AsyncClient(verify=verify, timeout=httpx_timeout) # type: ignore
self.verify = verify
self.httpx_timeout = httpx_timeout
@@ -659,11 +678,7 @@ class LlamaExtract(BaseComponent):
ExtractionAgent: The created extraction agent
"""
if config is not None:
if config.extraction_mode == ExtractMode.ACCURATE:
warnings.warn(
"ACCURATE extraction mode is deprecated. Using BALANCED instead."
)
config.extraction_mode = ExtractMode.BALANCED
_extraction_config_warning(config)
else:
config = DEFAULT_EXTRACT_CONFIG
@@ -680,11 +695,9 @@ class LlamaExtract(BaseComponent):
self._async_client.llama_extract.create_extraction_agent(
project_id=self._project_id,
organization_id=self._organization_id,
request=ExtractAgentCreate(
name=name,
data_schema=data_schema,
config=config,
),
name=name,
data_schema=data_schema,
config=config,
)
)
+6
View File
@@ -32,3 +32,9 @@ def augment_async_errors() -> Generator[None, None, None]:
JSONType = Union[Dict[str, Any], List[Any], str, int, float, bool, None]
JSONObjectType = Dict[str, JSONType]
class ExperimentalWarning(Warning):
"""Warning for experimental features."""
pass
+3 -2
View File
@@ -321,7 +321,7 @@ class LlamaParse(BasePydanticReader):
default=False,
description="Preserve grid alignment across page in text mode.",
)
replace_failed_page_mode: Optional[Union[FailedPageMode, str]] = Field(
replace_failed_page_mode: Optional[FailedPageMode] = Field(
default=None,
description="The mode to use to replace the failed page, see FailedPageMode enum for possible value. If set, the parser will replace the failed page with the specified mode. If not set, the default mode (raw_text) will be used.",
)
@@ -773,7 +773,8 @@ class LlamaParse(BasePydanticReader):
] = self.preserve_layout_alignment_across_pages
if self.replace_failed_page_mode is not None:
data["replace_failed_page_mode"] = self.replace_failed_page_mode
data["replace_failed_page_mode"] = self.replace_failed_page_mode.value
if self.replace_failed_page_with_error_message_prefix is not None:
data[
"replace_failed_page_with_error_message_prefix"
+6 -2
View File
@@ -60,8 +60,12 @@ class ImageItem(BaseModel):
width: float = Field(description="The width of the image.")
x: float = Field(description="The x-coordinate of the image.")
y: float = Field(description="The y-coordinate of the image.")
original_width: int = Field(description="The original width of the image.")
original_height: int = Field(description="The original height of the image.")
original_width: Optional[int] = Field(
default=None, description="The original width of the image."
)
original_height: Optional[int] = Field(
default=None, description="The original height of the image."
)
type: Optional[str] = Field(default=None, description="The type of the image.")
+2 -2
View File
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "llama-parse"
version = "0.6.14"
version = "0.6.17"
description = "Parse files into RAG-Optimized formats."
authors = ["Logan Markewich <logan@llamaindex.ai>"]
license = "MIT"
@@ -13,7 +13,7 @@ packages = [{include = "llama_parse"}]
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
llama-cloud-services = ">=0.6.14"
llama-cloud-services = ">=0.6.17"
[tool.poetry.group.dev.dependencies]
pytest = "^8.0.0"
Generated
+642 -620
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -8,7 +8,7 @@ python_version = "3.10"
[tool.poetry]
name = "llama-cloud-services"
version = "0.6.14"
version = "0.6.17"
description = "Tailored SDK clients for LlamaCloud services."
authors = ["Logan Markewich <logan@runllama.ai>"]
license = "MIT"
@@ -18,7 +18,7 @@ packages = [{include = "llama_cloud_services"}]
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
llama-index-core = ">=0.11.0"
llama-cloud = "^0.1.18"
llama-cloud = "==0.1.19"
pydantic = "!=2.10"
click = "^8.1.7"
python-dotenv = "^1.0.1"