openvino

package
v0.34.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package openvino implements the runtime/transport.Service boundary for the OpenVINO (Intel) backend: it opens persistent, manifest-keyed sessions on the owned device (CPU / GPU) that the runtime drives over the transport. It is not a modelprovider — the stateless modelprovider lives in the runtime; this package is the daemon-side compute implementation.

session.go adapts OpenVINO GenAI (string-prompt based, with the tokenizer, chat template, and prefix cache held inside the ContinuousBatchingPipeline) to the EnsurePrefix/PrefillSuffix/Decode contract. The native backend lives in the isolated sub-package ./ovsession behind the 'openvino' and 'openvino_genai' build tags, so the default build and CI never require OpenVINO or a C++ toolchain; without the tags ovsession reports Available == false and OpenSession returns the not-compiled-in error.

Build and benchmark the native path with Makefile.openvino (the CGO flags are derived from the OpenVINO wheels; CONTENOX_OPENVINO_DEVICE selects CPU/GPU).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGenAIVersion added in v0.32.6

func BuildGenAIVersion() string

BuildGenAIVersion returns the pinned OpenVINO GenAI version. Cheap and side-effect free, so `modeld version` can report it without loading native libs.

func ContextLength added in v0.34.0

func ContextLength(modelDir string) (int, error)

ContextLength returns an OpenVINO IR model's trained context ceiling (max_position_embeddings) via the same header-only native inspect openvinoModelParams uses — no GenAI pipeline load, no device query. Callers (e.g. modelstore.Admin.ListModels) should treat an error as "unknown" and skip enrichment for that one model, not fail the scan.

func HasAccelerator added in v0.32.4

func HasAccelerator() bool

HasAccelerator reports whether OpenVINO enumerates a non-CPU device on this host. modeld uses it for runtime backend selection.

func RuntimeInfo added in v0.32.4

func RuntimeInfo() transport.ModelInfo

RuntimeInfo reports the linked OpenVINO runtime identity and device inventory. In builds without the native OpenVINO GenAI tags, this returns a minimal record with RuntimeName set.

Types

type EmbedSessionBackend added in v0.32.2

type EmbedSessionBackend interface {
	Embed(ctx context.Context, prompt string) ([]float32, error)
	Close() error
}

type Service added in v0.32.2

type Service struct {
	// contains filtered or unexported fields
}

Service implements the runtime/transport.Service boundary for the OpenVINO GenAI backend. It opens persistent, manifest-keyed sessions on the owned device (CPU / GPU / NPU); the runtime reaches it as a client over the transport and never imports this package.

func NewService added in v0.32.4

func NewService(opts ...ServiceOption) *Service

func (*Service) Describe added in v0.32.2

Describe reports the model's trained context window read from the IR's config.json (max_position_embeddings) — no pipeline load. The runtime consumes this as the model's capacity; it never reads the IR files itself.

func (*Service) Embed added in v0.32.4

Embed runs a one-shot OpenVINO GenAI TextEmbeddingPipeline for req.Text. It is deliberately separate from OpenSession: embedding models do not use the chat session's prefix/suffix/Decode lifecycle.

func (*Service) OpenSession added in v0.32.2

OpenSession makes the model at req.Path (an OpenVINO IR directory, resolved by the runtime) resident and returns a session bound to it. It rejects a model typed for a different backend (ErrBackendMismatch) before loading, so a request for a llama model on an openvino-mode daemon fails at the boundary. In a build without the openvino + openvino_genai tags, ovsession.NewGenAI reports the backend is not compiled in and that error surfaces here unchanged.

type ServiceOption added in v0.32.4

type ServiceOption func(*Service)

func WithCapacityPolicy added in v0.32.4

func WithCapacityPolicy(p capacity.Policy) ServiceOption

func WithHostMemorySource added in v0.32.6

func WithHostMemorySource(src capacity.MemorySource) ServiceOption

func WithMemorySource added in v0.32.4

func WithMemorySource(src capacity.MemorySource) ServiceOption

Directories

Path Synopsis
Package ovsession contains the native OpenVINO session/KV bridge used by the openvino modelrepo provider.
Package ovsession contains the native OpenVINO session/KV bridge used by the openvino modelrepo provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL