Skip to content

Commit f584dc2

Browse files
author
zhansheng.lzs
committed
agentic-rl: merge from moe-dashscope-sdk-python
1 parent 58940f1 commit f584dc2

95 files changed

Lines changed: 23329 additions & 24 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dashscope/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
base_http_api_url,
2929
base_websocket_api_url,
3030
)
31-
from dashscope.customize.deployments import Deployments
32-
from dashscope.customize.finetunes import FineTunes
31+
from dashscope.finetune.deployments import Deployments
32+
from dashscope.finetune.finetunes import FineTunes
3333
from dashscope.embeddings.batch_text_embedding import BatchTextEmbedding
3434
from dashscope.embeddings.batch_text_embedding_response import (
3535
BatchTextEmbeddingResponse,

dashscope/audio/asr/asr_phrase_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from dashscope.client.base_api import BaseAsyncApi
99
from dashscope.common.error import InvalidParameter
1010
from dashscope.common.logging import logger
11-
from dashscope.customize.finetunes import FineTunes
11+
from dashscope.finetune.finetunes import FineTunes
1212

1313

1414
class AsrPhraseManager(BaseAsyncApi):

dashscope/cli.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env python
1+
# dashscope/cli.py
2+
# !/usr/bin/env python
23
# -*- coding: utf-8 -*-
34
import argparse
45
import json
@@ -16,6 +17,9 @@
1617
)
1718
from dashscope.utils.oss_utils import OssUtils
1819

20+
# ================= NEW: Routing & Dispatch Logic =================
21+
AGENTIC_RL_PREFIXES = {"agentic-rl", "rl"}
22+
1923

2024
def print_failed_message(rsp):
2125
print(
@@ -460,8 +464,18 @@ def __call__(self, parser, namespace, values, option_string=None):
460464
raise argparse.ArgumentError(self, str(message))
461465

462466

463-
# pylint: disable=too-many-statements
467+
464468
def main():
469+
# 1. Route check: If the second argument matches the new CLI prefix, forward to Typer
470+
if len(sys.argv) > 1 and sys.argv[1] in AGENTIC_RL_PREFIXES:
471+
# Remove the prefix argument so Typer can correctly parse subsequent subcommands (e.g., run, init, status)
472+
sys.argv.pop(1)
473+
#from dashscope.cli_agentic_rl import app
474+
from dashscope.finetune.reinforcement import app
475+
app()
476+
return
477+
478+
# 2. Original argparse logic (remains completely unchanged)
465479
parser = argparse.ArgumentParser(
466480
prog="dashscope",
467481
description="dashscope command line tools.",

dashscope/client/base_api.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -996,8 +996,8 @@ class LogMixin:
996996
def logs( # pylint: disable=unused-argument
997997
cls,
998998
job_id: str,
999-
offset=1,
1000-
line=1000,
999+
offset: int = 1,
1000+
line: int = 1000,
10011001
api_key: str = None,
10021002
path: str = None,
10031003
workspace: str = None,
@@ -1015,15 +1015,7 @@ def logs( # pylint: disable=unused-argument
10151015
DashScopeAPIResponse: The response
10161016
"""
10171017
custom_base_url = kwargs.pop("base_address", None)
1018-
if not custom_base_url:
1019-
url = join_url(
1020-
dashscope.base_http_api_url,
1021-
cls.SUB_PATH.lower(),
1022-
job_id,
1023-
"logs",
1024-
)
1025-
else:
1026-
url = custom_base_url
1018+
url = _get_url(custom_base_url, join_url(cls.SUB_PATH.lower(), job_id, "logs"), path)
10271019
params = {"offset": offset, "line": line}
10281020
return _get(
10291021
url,

0 commit comments

Comments
 (0)