-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add organization id and project id as args #616
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,16 +36,12 @@ jobs: | |
- name: Build and publish llama-cloud-services | ||
uses: JRubics/[email protected] | ||
with: | ||
poetry_version: ${{ env.POETRY_VERSION }} | ||
python_version: ${{ env.PYTHON_VERSION }} | ||
pypi_token: ${{ secrets.LLAMA_PARSE_PYPI_TOKEN }} | ||
poetry_install_options: "--without dev" | ||
|
||
- name: Build and publish llama-parse | ||
uses: JRubics/[email protected] | ||
with: | ||
poetry_version: ${{ env.POETRY_VERSION }} | ||
python_version: ${{ env.PYTHON_VERSION }} | ||
working_directory: "llama_parse" | ||
pypi_token: ${{ secrets.LLAMA_PARSE_PYPI_TOKEN }} | ||
poetry_install_options: "--without dev" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,21 @@ | |
JOB_UPLOAD_ROUTE = "/api/parsing/upload" | ||
|
||
|
||
def build_url( | ||
base_url: str, organization_id: Optional[str], project_id: Optional[str] | ||
) -> str: | ||
query_params = {} | ||
if organization_id: | ||
query_params["organization_id"] = organization_id | ||
if project_id: | ||
query_params["project_id"] = project_id | ||
|
||
if query_params: | ||
return base_url + "?" + "&".join([f"{k}={v}" for k, v in query_params.items()]) | ||
|
||
return base_url | ||
|
||
|
||
class LlamaParse(BasePydanticReader): | ||
"""A smart-parser for files.""" | ||
|
||
|
@@ -50,6 +65,14 @@ class LlamaParse(BasePydanticReader): | |
default=DEFAULT_BASE_URL, | ||
description="The base URL of the Llama Parsing API.", | ||
) | ||
organization_id: Optional[str] = Field( | ||
default=None, | ||
description="The organization ID for the LlamaParse API.", | ||
) | ||
project_id: Optional[str] = Field( | ||
default=None, | ||
description="The project ID for the LlamaParse API.", | ||
) | ||
check_interval: int = Field( | ||
default=1, | ||
description="The interval in seconds to check if the parsing is done.", | ||
|
@@ -639,7 +662,7 @@ async def _create_job( | |
if self.page_suffix is not None: | ||
data["page_suffix"] = self.page_suffix | ||
|
||
if self.parsing_instruction is not None: | ||
if self.parsing_instruction: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the default? empty str? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, and was causing this to print even though its technically unset |
||
print( | ||
"WARNING: parsing_instruction is deprecated. Use complemental_formatting_instruction or content_guideline_instruction instead." | ||
) | ||
|
@@ -706,7 +729,8 @@ async def _create_job( | |
data["gpt4o_api_key"] = self.gpt4o_api_key | ||
|
||
try: | ||
resp = await self.aclient.post(JOB_UPLOAD_ROUTE, files=files, data=data) # type: ignore | ||
url = build_url(JOB_UPLOAD_ROUTE, self.organization_id, self.project_id) | ||
resp = await self.aclient.post(url, files=files, data=data) # type: ignore | ||
resp.raise_for_status() # this raises if status is not 2xx | ||
return resp.json()["id"] | ||
except httpx.HTTPStatusError as err: # this catches it | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "llama-parse" | ||
version = "0.6.0" | ||
version = "0.6.1" | ||
description = "Parse files into RAG-Optimized formats." | ||
authors = ["Logan Markewich <[email protected]>"] | ||
license = "MIT" | ||
|
@@ -13,7 +13,7 @@ packages = [{include = "llama_parse"}] | |
|
||
[tool.poetry.dependencies] | ||
python = ">=3.9,<4.0" | ||
llama-cloud-services = "*" | ||
llama-cloud-services = ">=0.6.1" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^8.0.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ python_version = "3.10" | |
|
||
[tool.poetry] | ||
name = "llama-cloud-services" | ||
version = "0.6.0" | ||
version = "0.6.1" | ||
description = "Tailored SDK clients for LlamaCloud services." | ||
authors = ["Logan Markewich <[email protected]>"] | ||
license = "MIT" | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
causing publish error apparently