# Create Embedding Model

## User Intent

"I want to configure which embedding model to use for vector (semantic) search"

## Operation

* **SDK Methods**: `createSpecification()`, `updateProject()`
* **GraphQL**: `createSpecification`, `updateProject`

## TypeScript

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

const graphlit = new Graphlit();

// 1) Create a text-embedding specification
const spec = await graphlit.createSpecification({
  name: 'OpenAI Embedding 3 Large',
  type: SpecificationTypes.TextEmbedding,
  serviceType: ModelServiceTypes.OpenAi,
  openAI: {
    model: OpenAiModels.Embedding_3Large,
    chunkTokenLimit: 512,
  },
});

// 2) Set it as the project default text embedding strategy
await graphlit.updateProject({
  embeddings: {
    textSpecification: { id: spec.createSpecification.id },
  },
});
```

## Python

```python
from graphlit import Graphlit
from graphlit_api.enums import ModelServiceTypes, OpenAiModels, SpecificationTypes
from graphlit_api.input_types import (
    EmbeddingsStrategyInput,
    EntityReferenceInput,
    OpenAiModelPropertiesInput,
    ProjectUpdateInput,
    SpecificationInput,
)

graphlit = Graphlit()

spec = await graphlit.client.create_specification(
    SpecificationInput(
        name="OpenAI Embedding 3 Large",
        type=SpecificationTypes.TEXT_EMBEDDING,
        service_type=ModelServiceTypes.OPEN_AI,
        open_ai=OpenAiModelPropertiesInput(
            model=OpenAiModels.EMBEDDING_3_LARGE,
            chunk_token_limit=512,
        ),
    )
)

await graphlit.client.update_project(
    ProjectUpdateInput(
        embeddings=EmbeddingsStrategyInput(
            text_specification=EntityReferenceInput(id=spec.create_specification.id)
        )
    )
)
```

## C\#

```csharp
using GraphlitClient;
using System.Net.Http;
using StrawberryShake;

using var httpClient = new HttpClient();
var client = new Graphlit(httpClient);

var spec = await client.Client.CreateSpecification.ExecuteAsync(new SpecificationInput(
    name: "OpenAI Embedding 3 Large",
    type: SpecificationTypes.TextEmbedding,
    serviceType: ModelServiceTypes.OpenAi,
    openAi: new OpenAiModelPropertiesInput(
        model: OpenAiModels.Embedding_3Large,
        chunkTokenLimit: 512
    )
));

await client.Client.UpdateProject.ExecuteAsync(new ProjectUpdateInput(
    embeddings: new EmbeddingsStrategyInput(
        textSpecification: new EntityReferenceInput(spec.Data!.CreateSpecification!.Id)
    )
));
```


---

# Agent Instructions: 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:

```
GET https://docs.graphlit.dev/api-guides/use-cases/specifications/specification-create-embedding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
