# semanticSearchFiles

```graphql
query SemanticSearchFiles($input: SemanticSearchFilesInput!) {
  semanticSearchFiles(input: $input) {
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    totalMatches
    searchTimeMs
  }
}
```

Search files by vector. Requires project.knowledge.read.

## Arguments

| Name                   | Type                      | Required | Description                                                                                                                                           |
| ---------------------- | ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `input`                | SemanticSearchFilesInput! | Yes      |                                                                                                                                                       |
| `input.model`          | SemanticSearchModelInput  |          |                                                                                                                                                       |
| `input.queryVector`    | \[Float!]!                | Yes      | Pre-computed query vector (embedding of the search query), generated with an embedding provider                                                       |
| `input.dimension`      | EmbeddingDimension!       | Yes      | Embedding dimension (must match queryVector length) One of `D768`, `D1024`, `D1536`, `D3072`, `D4096`.                                                |
| `input.mode`           | SemanticSearchMode        |          | Search mode. Only SEMANTIC (the default) is supported; KEYWORD and HYBRID are refused with VALIDATION\_FAILED One of `SEMANTIC`, `KEYWORD`, `HYBRID`. |
| `input.environment`    | SearchEnvironment         |          | Search environment One of `PREVIEW`, `PRODUCTION`, `RELEASE`.                                                                                         |
| `input.branchId`       | ID                        |          | Branch ID for PREVIEW environment                                                                                                                     |
| `input.releaseId`      | ID                        |          | Release ID for RELEASE environment                                                                                                                    |
| `input.releaseVersion` | String                    |          | Release version for RELEASE environment                                                                                                               |
| `input.limit`          | Int                       |          | Maximum results                                                                                                                                       |
| `input.cursor`         | String                    |          | Pagination cursor                                                                                                                                     |
| `input.options`        | SemanticSearchOptions     |          | Search options                                                                                                                                        |

## Variables

```json
{
  "input": {
    "queryVector": [0],
    "dimension": "D768"
  }
}
```

## Responses

| Status | Description                                                  |
| ------ | ------------------------------------------------------------ |
| 200    | The SemanticSearchFilesPayload! in data.semanticSearchFiles. |

## 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 SemanticSearchFiles($input: SemanticSearchFilesInput!) {\n  semanticSearchFiles(input: $input) {\n    pageInfo {\n      hasNextPage\n      hasPreviousPage\n      startCursor\n      endCursor\n    }\n    totalMatches\n    searchTimeMs\n  }\n}",
  "variables": {
    "input": {
      "queryVector": [
        0
      ],
      "dimension": "D768"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "semanticSearchFiles": {
      "pageInfo": {
        "hasNextPage": false,
        "hasPreviousPage": false,
        "startCursor": "string",
        "endCursor": "string"
      },
      "totalMatches": 0,
      "searchTimeMs": 0
    }
  }
}
```
