forked from phoenix/litellm-mirror
fix cancel ft job route
This commit is contained in:
parent
7d06b77fd9
commit
a6e62da9fb
2 changed files with 19 additions and 2 deletions
|
@ -197,6 +197,11 @@ async def create_fine_tuning_job(
|
|||
dependencies=[Depends(user_api_key_auth)],
|
||||
tags=["fine-tuning"],
|
||||
)
|
||||
@router.get(
|
||||
"/fine_tuning/jobs",
|
||||
dependencies=[Depends(user_api_key_auth)],
|
||||
tags=["fine-tuning"],
|
||||
)
|
||||
async def list_fine_tuning_jobs(
|
||||
request: Request,
|
||||
fastapi_response: Response,
|
||||
|
@ -299,10 +304,14 @@ async def list_fine_tuning_jobs(
|
|||
dependencies=[Depends(user_api_key_auth)],
|
||||
tags=["fine-tuning"],
|
||||
)
|
||||
@router.post(
|
||||
"/fine_tuning/jobs/{fine_tuning_job_id:path}/cancel",
|
||||
dependencies=[Depends(user_api_key_auth)],
|
||||
tags=["fine-tuning"],
|
||||
)
|
||||
async def retrieve_fine_tuning_job(
|
||||
request: Request,
|
||||
fastapi_response: Response,
|
||||
custom_llm_provider: Literal["openai", "azure"],
|
||||
fine_tuning_job_id: str,
|
||||
user_api_key_dict: dict = Depends(user_api_key_auth),
|
||||
):
|
||||
|
@ -336,6 +345,10 @@ async def retrieve_fine_tuning_job(
|
|||
proxy_config=proxy_config,
|
||||
)
|
||||
|
||||
request_body = await request.json()
|
||||
|
||||
custom_llm_provider = request_body.get("custom_llm_provider", None)
|
||||
|
||||
# get configs for custom_llm_provider
|
||||
llm_provider_config = get_fine_tuning_provider_config(
|
||||
custom_llm_provider=custom_llm_provider
|
||||
|
|
|
@ -33,17 +33,21 @@ async def test_openai_fine_tuning():
|
|||
print("response from ft job={}".format(ft_job))
|
||||
|
||||
# response from example endpoint
|
||||
assert ft_job.id == "file-abc123"
|
||||
assert ft_job.id == "ftjob-abc123"
|
||||
|
||||
# list all fine tuning jobs
|
||||
list_ft_jobs = await client.fine_tuning.jobs.list(
|
||||
extra_query={"custom_llm_provider": "azure"}
|
||||
)
|
||||
|
||||
print("list of ft jobs={}".format(list_ft_jobs))
|
||||
|
||||
# cancel specific fine tuning job
|
||||
cancel_ft_job = await client.fine_tuning.jobs.cancel(
|
||||
fine_tuning_job_id="123",
|
||||
extra_body={"custom_llm_provider": "azure"},
|
||||
)
|
||||
|
||||
print("response from cancel ft job={}".format(cancel_ft_job))
|
||||
|
||||
assert cancel_ft_job.id is not None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue