> For the complete documentation index, see [llms.txt](https://docs.graphlit.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.graphlit.dev/api-guides/use-cases/specifications/specification-query.md).

# Query Specifications

## Specification: Query Specifications

### User Intent

"I want to list all my model specifications"

### Operation

* **SDK Method**: `graphlit.querySpecifications()`
* **GraphQL**: `querySpecifications` query
* **Entity Type**: Specification
* **Common Use Cases**: List specifications, find spec by name, check configurations

### TypeScript (Canonical)

```typescript
import { Graphlit } from 'graphlit-client';
import { ModelServiceTypes, SpecificationTypes } from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

// Query all specifications
const specs = await graphlit.querySpecifications();

console.log(`Total specifications: ${specs.specifications.results.length}\n`);

specs.specifications.results.forEach(spec => {
  console.log(`- ${spec.name} (${spec.type})`);
  console.log(`  Model: ${spec.serviceType}`);
});

// Search by name
const searchResults = await graphlit.querySpecifications({
  search: 'GPT-4o'
});

console.log(`\nFound ${searchResults.specifications.results.length} GPT-4o specs`);

// Filter by type
const completionSpecs = await graphlit.querySpecifications({
  types: [SpecificationTypes.Completion]
});

console.log(`\nCompletion specs: ${completionSpecs.specifications.results.length}`);
```

## Query all specifications (snake\_case)

specs = await graphlit.querySpecifications()

print(f"Total specifications: {len(specs.specifications.results)}")

for spec in specs.specifications.results: print(f"- {spec.name} ({spec.type})")

## Filter by type

completion\_specs = await graphlit.querySpecifications( filter=SpecificationFilterInput( types=\[SpecificationTypes.Completion] ) )

````

**C#**:
```csharp
using Graphlit;

var client = new Graphlit();

// Query all specifications (PascalCase)
var specs = await graphlit.QuerySpecifications();

Console.WriteLine($"Total specifications: {specs.Specifications.Results.Count}");

foreach (var spec in specs.Specifications.Results)
{
    Console.WriteLine($"- {spec.Name} ({spec.Type})");
}

// Filter by type
var completionSpecs = await graphlit.QuerySpecifications(new SpecificationFilter {
    Types = new[] { SpecificationTypes.Completion }
});
````

### Parameters

#### SpecificationFilter (Optional)

* **`search`** (string): Search by name
* **`types`** (SpecificationTypes\[]): Filter by type
  * `COMPLETION`, `EXTRACTION`, `PREPARATION`, `EMBEDDING`

### Response

```typescript
{
  specifications: {
    results: Specification[];
  }
}

interface Specification {
  id: string;
  name: string;
  type: SpecificationTypes;
  serviceType: ModelServiceTypes;
}
```

### Developer Hints

#### Filter by Type

```typescript
// Completion specs
const completion = await graphlit.querySpecifications({
  types: [SpecificationTypes.Completion]
});

// Extraction specs
const extraction = await graphlit.querySpecifications({
  types: [SpecificationTypes.Extraction]
});

// Embedding specs
const embedding = await graphlit.querySpecifications({
  types: [SpecificationTypes.Embedding]
});
```

### Variations

#### 1. List All

```typescript
const specs = await graphlit.querySpecifications();
console.log(`You have ${specs.specifications.results.length} specifications`);
```

#### 2. Search by Name

```typescript
const results = await graphlit.querySpecifications({
  search: 'Claude'
});
```

#### 3. Group by Type

```typescript
const specs = await graphlit.querySpecifications();

const byType = specs.specifications.results.reduce((acc, spec) => {
  acc[spec.type] = (acc[spec.type] || 0) + 1;
  return acc;
}, {} as Record<string, number>);

console.log('Specifications by type:', byType);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.graphlit.dev/api-guides/use-cases/specifications/specification-query.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
