Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ repos:
- id: prettier
additional_dependencies: [ 'prettier@3.0.0' ]
files: \.(tsx?)$
exclude: ^(tests/legacy|samples)/
exclude: ^(tests/legacy|samples)/
4 changes: 2 additions & 2 deletions dashscope/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
base_http_api_url,
base_websocket_api_url,
)
from dashscope.customize.deployments import Deployments
from dashscope.customize.finetunes import FineTunes
from dashscope.finetune.deployments import Deployments
from dashscope.finetune.finetunes import FineTunes
from dashscope.embeddings.batch_text_embedding import BatchTextEmbedding
from dashscope.embeddings.batch_text_embedding_response import (
BatchTextEmbeddingResponse,
Expand Down
2 changes: 1 addition & 1 deletion dashscope/audio/asr/asr_phrase_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dashscope.client.base_api import BaseAsyncApi
from dashscope.common.error import InvalidParameter
from dashscope.common.logging import logger
from dashscope.customize.finetunes import FineTunes
from dashscope.finetune.finetunes import FineTunes


class AsrPhraseManager(BaseAsyncApi):
Expand Down
25 changes: 22 additions & 3 deletions dashscope/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# dashscope/cli.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import json
Expand All @@ -16,6 +18,9 @@
)
from dashscope.utils.oss_utils import OssUtils

# ================= NEW: Routing & Dispatch Logic =================
AGENTIC_RL_PREFIXES = {"agentic-rl", "rl"}


def print_failed_message(rsp):
print(
Expand Down Expand Up @@ -460,8 +465,22 @@ def __call__(self, parser, namespace, values, option_string=None):
raise argparse.ArgumentError(self, str(message))


# pylint: disable=too-many-statements
def main():
def main(): # pylint: disable=too-many-statements
# 1. Route check: If the second argument matches the new CLI prefix,
# forward to Typer
if len(sys.argv) > 1 and sys.argv[1] in AGENTIC_RL_PREFIXES:
# Remove the prefix argument so Typer can correctly parse subsequent
# subcommands (e.g., run, init, get)
sys.argv.pop(1)

# pylint: disable=no-name-in-module
from dashscope.finetune.reinforcement import app

app()

return

# 2. Original argparse logic (remains completely unchanged)
parser = argparse.ArgumentParser(
prog="dashscope",
description="dashscope command line tools.",
Expand Down
18 changes: 7 additions & 11 deletions dashscope/client/base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,8 @@ class LogMixin:
def logs( # pylint: disable=unused-argument
cls,
job_id: str,
offset=1,
line=1000,
offset: int = 1,
line: int = 1000,
api_key: str = None,
path: str = None,
workspace: str = None,
Expand All @@ -1015,15 +1015,11 @@ def logs( # pylint: disable=unused-argument
DashScopeAPIResponse: The response
"""
custom_base_url = kwargs.pop("base_address", None)
if not custom_base_url:
url = join_url(
dashscope.base_http_api_url,
cls.SUB_PATH.lower(),
job_id,
"logs",
)
else:
url = custom_base_url
url = _get_url(
custom_base_url,
join_url(cls.SUB_PATH.lower(), job_id, "logs"),
path,
)
params = {"offset": offset, "line": line}
return _get(
url,
Expand Down
File renamed without changes.
Loading
Loading