feat: ✨ AI Read File Tool, Configurable system prompts and loading lots of llms
This commit is contained in:
+7
-3
@@ -1,12 +1,16 @@
|
||||
import requests
|
||||
from langchain_core.embeddings import Embeddings
|
||||
from config_loader import load_config
|
||||
|
||||
CFG = load_config()
|
||||
API_BASE = CFG["api"]["base_url"]
|
||||
API_VERSION = CFG["api"]["api_version"]
|
||||
|
||||
class LocalLMEmbeddings(Embeddings):
|
||||
def __init__(
|
||||
self, model: str, base_url: str = "http://192.168.0.49:1234", batch_size: int = 32
|
||||
self, model: str, base_url: str = API_BASE, batch_size: int = 32
|
||||
):
|
||||
self.url = f"{base_url}/v1/embeddings"
|
||||
self.url = f"{base_url}/{API_VERSION}/embeddings"
|
||||
self.model = model
|
||||
self.batch_size = batch_size
|
||||
|
||||
@@ -27,7 +31,7 @@ class LocalLMEmbeddings(Embeddings):
|
||||
return [[] for _ in input_texts]
|
||||
|
||||
def embed_documents(self, texts: list[str]) -> list[list[float]]:
|
||||
"""Splits 500+ chunks into batches of 32 and processes them."""
|
||||
"""Splits chunks into batches of 32 and processes them."""
|
||||
all_embeddings = []
|
||||
|
||||
for i in range(0, len(texts), self.batch_size):
|
||||
|
||||
Reference in New Issue
Block a user