MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / _model_meta_value

Method _model_meta_value

examples/server/server.py:11849–11866  ·  view source on GitHub ↗
(llama_model: Any, key: str)

Source from the content-addressed store, hash-verified

11847
11848 @staticmethod
11849 def _model_meta_value(llama_model: Any, key: str) -> Optional[str]:
11850 encoded = key.encode("utf-8")
11851 capacity = 256
11852 while True:
11853 buffer = ctypes.create_string_buffer(capacity)
11854 count = int(
11855 llama_cpp.llama_model_meta_val_str(
11856 llama_model,
11857 encoded,
11858 cast(Any, buffer),
11859 capacity,
11860 )
11861 )
11862 if count < 0:
11863 return None
11864 if count < capacity:
11865 return buffer.value.decode("utf-8", errors="ignore")
11866 capacity = count + 1
11867
11868 @staticmethod
11869 def _parse_pooling_type(value: str) -> Optional[int]:

Callers 2

_meta_valueMethod · 0.95

Calls 2

encodeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected