LlamaCPP๏ƒ

pydantic model llama_index.llms.llama_cpp.LlamaCPP๏ƒ

Show JSON schema
{
   "title": "LlamaCPP",
   "description": "Simple abstract base class for custom LLMs.\n\nSubclasses must implement the `__init__`, `complete`,\n    `stream_complete`, and `metadata` methods.",
   "type": "object",
   "properties": {
      "callback_manager": {
         "title": "Callback Manager"
      },
      "model_url": {
         "title": "Model Url",
         "description": "The URL llama-cpp model to download and use.",
         "type": "string"
      },
      "model_path": {
         "title": "Model Path",
         "description": "The path to the llama-cpp model to use.",
         "type": "string"
      },
      "temperature": {
         "title": "Temperature",
         "description": "The temperature to use for sampling.",
         "type": "number"
      },
      "max_new_tokens": {
         "title": "Max New Tokens",
         "description": "The maximum number of tokens to generate.",
         "type": "integer"
      },
      "context_window": {
         "title": "Context Window",
         "description": "The maximum number of context tokens for the model.",
         "type": "integer"
      },
      "generate_kwargs": {
         "title": "Generate Kwargs",
         "description": "Kwargs used for generation.",
         "type": "object"
      },
      "model_kwargs": {
         "title": "Model Kwargs",
         "description": "Kwargs used for model initialization.",
         "type": "object"
      },
      "verbose": {
         "title": "Verbose",
         "description": "Whether to print verbose output.",
         "type": "boolean"
      }
   },
   "required": [
      "temperature",
      "max_new_tokens",
      "context_window",
      "verbose"
   ]
}

Config
  • arbitrary_types_allowed: bool = True

Fields
Validators
  • _validate_callback_manager ยป callback_manager

field completion_to_prompt: Callable [Required]๏ƒ

The function to convert a completion to a prompt.

field context_window: int [Required]๏ƒ

The maximum number of context tokens for the model.

field generate_kwargs: Dict[str, Any] [Optional]๏ƒ

Kwargs used for generation.

field max_new_tokens: int [Required]๏ƒ

The maximum number of tokens to generate.

field messages_to_prompt: Callable [Required]๏ƒ

The function to convert messages to a prompt.

field model_kwargs: Dict[str, Any] [Optional]๏ƒ

Kwargs used for model initialization.

field model_path: Optional[str] = None๏ƒ

The path to the llama-cpp model to use.

field model_url: Optional[str] = None๏ƒ

The URL llama-cpp model to download and use.

field temperature: float [Required]๏ƒ

The temperature to use for sampling.

field verbose: bool [Required]๏ƒ

Whether to print verbose output.

chat(messages: Sequence[ChatMessage], **kwargs: Any) Any๏ƒ

Chat endpoint for LLM.

classmethod class_name() str๏ƒ

Get class name.

complete(*args: Any, **kwargs: Any) Any๏ƒ

Completion endpoint for LLM.

stream_chat(messages: Sequence[ChatMessage], **kwargs: Any) Any๏ƒ

Streaming chat endpoint for LLM.

stream_complete(*args: Any, **kwargs: Any) Any๏ƒ

Streaming completion endpoint for LLM.

property metadata: LLMMetadata๏ƒ

LLM metadata.