Generate structured context data for fine-tuning using data jobs.
Context-grounded fine-tuning stops working on November 9, 2026. You can keep using it until then. For new projects, choose another fine-tuning method.
Context-grounded data jobs ground model responses in an existing knowledge source. Two job types are available:
context_grounded_files — aligns against uploaded and ingested documents. Follows the same file preparation and ingestion steps as principle_files, but no system prompt is required.
context_grounded_vector_db — aligns against a pre-built SeekrFlow vector database. No file upload or ingestion is needed.
Neither type requires a system prompt to start. Not sure which approach fits your use case? See Fine-tuning.
from seekrai import SeekrFlowclient = SeekrFlow()data_job = client.data_jobs.create( name="Customer support context grounding", instructions="Generate QA pairs grounded in the ingested support docs.", job_type="context_grounded_files",)data_job_id = data_job.idprint("Data job ID:", data_job_id)
Step 2: Upload and attach files
Upload your source files using the Files API, then attach them to the job. Ingestion runs automatically for non-Markdown files. Markdown files are alignment-ready immediately.Endpoint:POST /v1/flow/data-jobs/{id}/add-files
status_message gives a human-readable description of the alignment job’s current state, including the reason if the job fails.Once status shows completed, retrieve the output files as described in Step 5.
detail = client.data_jobs.retrieve(data_job_id)outputs = detail.alignment_job.output_filesfor f in outputs: print(f.id, f.filename, f.file_type, f.purpose)
The output file with "purpose": "fine-tune" (the .parquet) is the file ID to use when creating a fine-tuning job.
context_grounded_vector_db
Use this job type when your knowledge source is already indexed in a SeekrFlow vector database. No file upload or ingestion is needed — attach the vector database ID and start.
Step 1: Create the job and attach the vector database
Endpoints:POST /v1/flow/data-jobsSubmit data job · PATCH /v1/flow/data-jobs/{id}Update data jobCreate the job and set vector_database_id before starting. No file upload or ingestion is needed.
data_job = client.data_jobs.create( name="Customer support refresh", instructions="Generate QA pairs grounded in the existing vector store.", job_type="context_grounded_vector_db",)data_job_id = data_job.iddata_job = client.data_jobs.update( data_job_id, vector_database_id="9aab2ceb-7c7b-4c07-8ff4-5416dfad221a",)print("Vector DB set:", data_job.vector_database_id)