diff --git a/saagieapi/jobs/gql_queries.py b/saagieapi/jobs/gql_queries.py index 42a1bef..e3fcc95 100644 --- a/saagieapi/jobs/gql_queries.py +++ b/saagieapi/jobs/gql_queries.py @@ -599,13 +599,3 @@ moveJob(jobId: $jobId, targetPlatformId: $targetPlatformId, targetProjectId: $targetProjectId) } """ - -GQL_GENERATE_JOB_DESCRIPTION = """ -mutation editJobWithAiGeneratedDescriptionMutation($jobId: UUID!) { - editJobWithAiGeneratedDescription(jobId: $jobId) { - id - description - aiDescriptionVersionNumber - } -} -""" diff --git a/saagieapi/jobs/jobs.py b/saagieapi/jobs/jobs.py index b7a004b..b0963e0 100644 --- a/saagieapi/jobs/jobs.py +++ b/saagieapi/jobs/jobs.py @@ -1970,39 +1970,3 @@ def move_job(self, job_id: str, target_platform_id: int, target_project_id: str) "targetProjectId": target_project_id, }, ) - - def generate_description_by_ai(self, job_id: str): - """Generate a description for a job using AI. - Be careful, by calling this function the code contained in the job package will be sent to OpenAI - and thus will not be secured anymore by Saagie DataOps Platform. - Otherwise, the function returns an error if the description is already the one generated by AI. - - Parameters - ---------- - job_id : str - UUID of your job (see README on how to find it) - - Returns - ------- - dict - Dict of the generated description - - Examples - -------- - >>> saagie_api.jobs.generate_description_by_ai(job_id=job_id) - { - 'editJobWithAiGeneratedDescription': { - 'id': 'bfa25e4a-1796-4ebb-8c3d-138f74146973', - 'description': 'The purpose of this code is to display the message "Hello World" on the screen.', - 'aiDescriptionVersionNumber': 1 - } - } - """ - # if executed a second time and the description is already the one generated by AI, - # it will return an error and I don't know how to handle it - # example : TransportQueryError: {'message': 'Job not valid', 'path': ['editJobWithAiGeneratedDescription'], - # 'extensions': {'job.description': 'Job description is already generated', 'classification':'ValidationError'}} - - return self.saagie_api.client.execute( - query=gql(GQL_GENERATE_JOB_DESCRIPTION), variable_values={"jobId": job_id} - ) diff --git a/tests/integration/jobs_integration_test.py b/tests/integration/jobs_integration_test.py index 703e76a..6ab860d 100644 --- a/tests/integration/jobs_integration_test.py +++ b/tests/integration/jobs_integration_test.py @@ -469,16 +469,6 @@ def test_move_job(create_then_delete_job, create_global_project): assert job_init["job"]["name"] == job_after["job"]["name"] - @staticmethod - def test_generate_description_by_ai(create_then_delete_job, create_global_project): - conf = create_global_project - job_id = create_then_delete_job - - result = conf.saagie_api.jobs.generate_description_by_ai(job_id=job_id) - - assert "editJobWithAiGeneratedDescription" in result - assert result["editJobWithAiGeneratedDescription"]["id"] == job_id - @staticmethod def test_get_info_by_alias(create_global_project, create_then_delete_job): conf = create_global_project diff --git a/tests/unit/jobs_unit_test.py b/tests/unit/jobs_unit_test.py index 052d62a..2006666 100644 --- a/tests/unit/jobs_unit_test.py +++ b/tests/unit/jobs_unit_test.py @@ -1391,20 +1391,3 @@ def test_move_job(self, saagie_api_mock): instance.move_job(**job_params) saagie_api_mock.client.execute.assert_called_with(query=expected_query, variable_values=params) - - def test_generate_description_by_ai_gql(self): - self.client.validate(gql(GQL_GENERATE_JOB_DESCRIPTION)) - - def test_generate_description_by_ai(self, saagie_api_mock): - instance = Jobs(saagie_api_mock) - - job_id = "860b8dc8-e634-4c98-b2e7-f9ec32ab4771" - params = { - "jobId": job_id, - } - - expected_query = gql(GQL_GENERATE_JOB_DESCRIPTION) - - instance.generate_description_by_ai(job_id=job_id) - - saagie_api_mock.client.execute.assert_called_with(query=expected_query, variable_values=params) diff --git a/tests/unit/resources/schema.graphqls b/tests/unit/resources/schema.graphqls index 06280fe..892f154 100644 --- a/tests/unit/resources/schema.graphqls +++ b/tests/unit/resources/schema.graphqls @@ -471,14 +471,6 @@ type Mutation { # You can only edit a job if you have at least the editor role in the project associated to the job or in all projects. editJob(job: JobEditionInput!): Job! - # Edit a job description by AI. - # - # The job description will be edited and replaced by a text generated by a generative AI based on the job's source code, - # which will be sent to a service external to Saagie. - # - # You can only edit a job if you have at least the editor role in the project associated to the job or in all projects. - editJobWithAiGeneratedDescription(jobId: UUID!): Job! - # Add a job version. # # **Fields validation:** @@ -1196,8 +1188,6 @@ type Job { # Only alphanumeric and underscore characters are allowed. alias: String description: String - aiDescriptionVersionNumber: Int - aiDescriptionState: JobAiGeneratedDescriptionState countJobInstance: Int # Attribute checkInPipelineInstance is now deprecated instances(limit: Int, skip: Int, checkInPipelineInstance: Boolean, lastExecution: Boolean): [JobInstance!]