mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-04-27 20:40:27 +00:00
fix: user_api_key capturing
This commit is contained in:
@@ -4,7 +4,14 @@ from application.core.settings import settings
|
||||
|
||||
class LlamaCpp(BaseLLM):
|
||||
|
||||
def __init__(self, api_key=None, llm_name=settings.MODEL_PATH, *args, **kwargs):
|
||||
def __init__(
|
||||
self,
|
||||
api_key=None,
|
||||
user_api_key=None,
|
||||
llm_name=settings.MODEL_PATH,
|
||||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
global llama
|
||||
try:
|
||||
from llama_cpp import Llama
|
||||
@@ -15,6 +22,7 @@ class LlamaCpp(BaseLLM):
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
self.api_key = api_key
|
||||
self.user_api_key = user_api_key
|
||||
llama = Llama(model_path=llm_name, n_ctx=2048)
|
||||
|
||||
def _raw_gen(self, baseself, model, messages, stream=False, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user