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)

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

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

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

Developer Hints

Filter by Type

// 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

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

2. Search by Name

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

3. Group by Type

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);

Last updated

Was this helpful?