Skip to content

Commit

Permalink
Update Local-LLM to 0.0.39 (#1084)
Browse files Browse the repository at this point in the history
* Update Local-LLM to 0.0.39

* Format prompt if no prefix and suffix
  • Loading branch information
Josh-XT authored Jan 7, 2024
1 parent 053f936 commit 327c8f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions agixt/providers/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,34 @@ def __init__(
AI_MODEL: str = "Mistral-7B-OpenOrca",
AI_TEMPERATURE: float = 0.7,
AI_TOP_P: float = 0.95,
PROMPT_PREFIX: str = "",
PROMPT_SUFFIX: str = "",
**kwargs,
):
self.requirements = ["local-llm"]
self.AI_MODEL = AI_MODEL if AI_MODEL else "Mistral-7B-OpenOrca"
self.AI_TEMPERATURE = AI_TEMPERATURE if AI_TEMPERATURE else 0.7
self.AI_TOP_P = AI_TOP_P if AI_TOP_P else 0.95
self.PROMPT_PREFIX = PROMPT_PREFIX if PROMPT_PREFIX else ""
self.PROMPT_SUFFIX = PROMPT_SUFFIX if PROMPT_SUFFIX else ""

def models(self):
return LLM().models()

async def inference(self, prompt, tokens: int = 0):
models_dir = os.path.join(os.getcwd(), "models")
prompt = f"{self.PROMPT_PREFIX}{prompt}{self.PROMPT_SUFFIX}"
if self.PROMPT_PREFIX != "" and self.PROMPT_SUFFIX != "":
format_prompt = False
else:
format_prompt = True
try:
response = LLM(
models_dir=models_dir,
model=self.AI_MODEL,
temperature=float(self.AI_TEMPERATURE),
top_p=float(self.AI_TOP_P),
).completion(
prompt=prompt,
)
).completion(prompt=prompt, format_prompt=format_prompt)
return response["choices"][0]["text"]
except Exception as e:
logging.error(f"Local-LLM Error: {e}")
Expand Down
2 changes: 1 addition & 1 deletion agixt/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.4.46
v1.4.47
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
agixtsdk==0.0.29
safeexecute==0.0.9
local-llm==0.0.38
local-llm==0.0.39
google-generativeai==0.3.2
discord==2.3.2
anthropic==0.8.1
Expand Down

0 comments on commit 327c8f2

Please sign in to comment.