@@ -15,6 +15,7 @@ import io.ktor.server.plugins.statuspages.*
1515import io.ktor.server.request.*
1616import io.ktor.server.response.*
1717import io.ktor.server.routing.*
18+ import kotlinx.serialization.json.*
1819import org.slf4j.Logger
1920import org.slf4j.event.Level
2021
@@ -86,8 +87,11 @@ fun createOllamaServer(config: OllamaConfig): EmbeddedServer<CIOApplicationEngin
8687 apiProvider.generateOStream(requestWithOriginalModelName),
8788 )
8889 }
90+ post(" /api/show" ) {
91+ call.receiveText()
92+ call.respond(mockOModelInfoResponse)
93+ }
8994 }
90-
9195 }
9296 }
9397
@@ -108,3 +112,40 @@ private fun Application.configureServerCommon(callLogger: Logger) {
108112 }
109113 }
110114}
115+
116+ private val mockOModelInfoResponse = buildJsonObject {
117+ put(" modelfile" , " Mock modelfile" )
118+ put(" parameters" , " Mock parameters" )
119+ put(" template" , " Mock template" )
120+ putJsonObject(" details" ) {
121+ put(" parent_model" , " " )
122+ put(" format" , " gguf" )
123+ put(" family" , " llama" )
124+ putJsonArray(" families" ) { add(" llama" ) }
125+ put(" parameter_size" , " 8.0B" )
126+ put(" quantization_level" , " Q4_0" )
127+ }
128+ putJsonObject(" model_info" ) {
129+ put(" general.architecture" , " llama" )
130+ put(" general.file_type" , 2 )
131+ put(" general.parameter_count" , 8030261248L )
132+ put(" general.quantization_version" , 2 )
133+ put(" llama.attention.head_count" , 32 )
134+ put(" llama.attention.head_count_kv" , 8 )
135+ put(" llama.attention.layer_norm_rms_epsilon" , 0.00001 )
136+ put(" llama.block_count" , 32 )
137+ put(" llama.context_length" , 8192 )
138+ put(" llama.embedding_length" , 4096 )
139+ put(" llama.feed_forward_length" , 14336 )
140+ put(" llama.rope.dimension_count" , 128 )
141+ put(" llama.rope.freq_base" , 500000 )
142+ put(" llama.vocab_size" , 128256 )
143+ put(" tokenizer.ggml.bos_token_id" , 128000 )
144+ put(" tokenizer.ggml.eos_token_id" , 128009 )
145+ putJsonArray(" tokenizer.ggml.merges" ) {}
146+ put(" tokenizer.ggml.model" , " gpt2" )
147+ put(" tokenizer.ggml.pre" , " llama-bpe" )
148+ putJsonArray(" tokenizer.ggml.token_type" ) {}
149+ putJsonArray(" tokenizer.ggml.tokens" ) {}
150+ }
151+ }
0 commit comments