---
title: "fromGraph"
sidebar_label: "fromGraph"
description: "Kotlin binding reference: fromGraph."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../../index.md)/[io.clika.runtime](../../index.md)/[FunctionModel](../index.md)/[Companion](index.md)/[fromGraph](fromGraph.md)

# fromGraph

[common]\
fun [fromGraph](fromGraph.md)(graph: [ModelGraph](../../ModelGraph/index.md), kv: [KVSpecOptions](../../KVSpecOptions/index.md) = KVSpecOptions()): [FunctionModel](../index.md)

A serving model over a finalized [graph](fromGraph.md): its inputs and outputs are the graph's (a graph with a KV cache keeps per-session cache planes sized by [kv](fromGraph.md), and its past inputs leave the contract). The graph is taken: it moves into the model and the given [ModelGraph](../../ModelGraph/index.md) is emptied, whether the model is built or the call fails (an empty graph, or a KV graph without a positive past length).