# evalSource

```graphql
query EvalSource($projectReference: String!, $evalId: String!) {
  evalSource(projectReference: $projectReference, evalId: $evalId) {
    id
    name
    description
    targetKind
    target
    sourcePath
    exportName
    source
    dataset {
      kind
      path
      editable
      dynamic
    }
    metrics {
      name
      family
      severity
      config
      editable
      dynamic
    }
    repetitions
    tags
    metadata
    editableFields
    dynamicFields
    capabilities
    editMode
    sourceOnlyReasons
  }
}
```

Read the editable source behind one eval before changing it; returns the eval source document with its source text, edit mode and the reasons it can only be edited as source. Requires project.evals.read.

## Arguments

| Name                     | Type             | Required | Description                                                               |
| ------------------------ | ---------------- | -------- | ------------------------------------------------------------------------- |
| `projectReference`       | String!          | Yes      |                                                                           |
| `evalId`                 | String!          | Yes      |                                                                           |
| `input`                  | WriteTargetInput |          |                                                                           |
| `input.sourceTargetKind` | WriteTargetKind  |          | The source to write; default project. One of `project`, `preview_branch`. |
| `input.targetBranchId`   | ID               |          | Required with the kind preview\_branch.                                   |

## Variables

```json
{
  "projectReference": "string",
  "evalId": "string"
}
```

## Responses

| Status | Description                         |
| ------ | ----------------------------------- |
| 200    | The EvalSource! in data.evalSource. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query EvalSource($projectReference: String!, $evalId: String!) {\n  evalSource(projectReference: $projectReference, evalId: $evalId) {\n    id\n    name\n    description\n    targetKind\n    target\n    sourcePath\n    exportName\n    source\n    dataset {\n      kind\n      path\n      editable\n      dynamic\n    }\n    metrics {\n      name\n      family\n      severity\n      config\n      editable\n      dynamic\n    }\n    repetitions\n    tags\n    metadata\n    editableFields\n    dynamicFields\n    capabilities\n    editMode\n    sourceOnlyReasons\n  }\n}",
  "variables": {
    "projectReference": "string",
    "evalId": "string"
  }
}'
```

## Example response

```json
{
  "data": {
    "evalSource": {
      "id": "string",
      "name": "string",
      "description": "string",
      "targetKind": "agent",
      "target": "string",
      "sourcePath": "string",
      "exportName": "string",
      "source": "string",
      "dataset": {
        "kind": "inline",
        "path": "string",
        "editable": false,
        "dynamic": false
      },
      "metrics": [
        {
          "name": "string",
          "family": "answer",
          "severity": "gate",
          "config": {},
          "editable": false,
          "dynamic": false
        }
      ],
      "repetitions": 0,
      "tags": [
        "string"
      ],
      "metadata": {},
      "editableFields": [
        "name"
      ],
      "dynamicFields": [
        "name"
      ],
      "capabilities": [
        "string"
      ],
      "editMode": "structured",
      "sourceOnlyReasons": [
        "string"
      ]
    }
  }
}
```
