feat: agent files
This commit is contained in:
14
core/backend/__init__.py
Normal file
14
core/backend/__init__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from langchain_openai import ChatOpenAI
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# Get configuration from environment variables
|
||||
LLAMA_SERVER_URL = os.getenv("LLAMA_SERVER_URL", "http://127.0.0.1:8013")
|
||||
LLAMA_MODEL_NAME = os.getenv("LLAMA_MODEL_NAME", "ggml-org_gpt-oss-20b-GGUF_gpt-oss-20b-mxfp4.gguf")
|
||||
|
||||
llm = None
|
||||
if "gpt-oss-20b" in LLAMA_MODEL_NAME:
|
||||
from core.backend.llama_gpt_oss import get_llama_oss_20b_llm
|
||||
llm = get_llama_oss_20b_llm(LLAMA_SERVER_URL, LLAMA_MODEL_NAME)
|
||||
BIN
core/backend/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
core/backend/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
core/backend/__pycache__/llama_gpt_oss.cpython-312.pyc
Normal file
BIN
core/backend/__pycache__/llama_gpt_oss.cpython-312.pyc
Normal file
Binary file not shown.
9
core/backend/llama_gpt_oss.py
Normal file
9
core/backend/llama_gpt_oss.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from langchain_openai import ChatOpenAI
|
||||
|
||||
def get_llama_oss_20b_llm(server_url, model_name):
|
||||
"""Initialize and return a ChatOpenAI instance configured for llama-oss-20b."""
|
||||
return ChatOpenAI(
|
||||
base_url=f"{server_url}/v1",
|
||||
api_key="not-needed",
|
||||
model=model_name
|
||||
)
|
||||
Reference in New Issue
Block a user