Update max_token and formatting (#2273)
This commit is contained in:
@@ -24,7 +24,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "arn:aws:bedrock:us-east-1:123456789012:model/your-model-name",
|
"model": "arn:aws:bedrock:us-east-1:123456789012:model/your-model-name",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "deepseek-chat", # default model
|
"model": "deepseek-chat", # default model
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
"top_p": 1.0
|
"top_p": 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "gemini-1.5-flash-latest",
|
"model": "gemini-1.5-flash-latest",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "gemini/gemini-pro",
|
"model": "gemini/gemini-pro",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "mixtral-8x7b-32768",
|
"model": "mixtral-8x7b-32768",
|
||||||
"temperature": 0.1,
|
"temperature": 0.1,
|
||||||
"max_tokens": 1000,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "gpt-4o-mini",
|
"model": "gpt-4o-mini",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "gpt-4o",
|
"model": "gpt-4o",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
"model": "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "grok-2-latest",
|
"model": "grok-2-latest",
|
||||||
"temperature": 0.1,
|
"temperature": 0.1,
|
||||||
"max_tokens": 1000,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "llama3.1:latest",
|
"model": "llama3.1:latest",
|
||||||
"temperature": 0,
|
"temperature": 0,
|
||||||
"max_tokens": 8000,
|
"max_tokens": 2000,
|
||||||
"ollama_base_url": "http://localhost:11434", # Ensure this URL is correct
|
"ollama_base_url": "http://localhost:11434", # Ensure this URL is correct
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "gpt-4o",
|
"model": "gpt-4o",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"custom_prompt": custom_prompt,
|
"custom_prompt": custom_prompt,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "gpt-4o",
|
"model": "gpt-4o",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"embedder": {
|
"embedder": {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ config = {
|
|||||||
"config": {
|
"config": {
|
||||||
"model": "gpt-4o",
|
"model": "gpt-4o",
|
||||||
"temperature": 0.2,
|
"temperature": 0.2,
|
||||||
"max_tokens": 1500,
|
"max_tokens": 2000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"graph_store": {
|
"graph_store": {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class BaseLlmConfig(ABC):
|
|||||||
model: Optional[str] = None,
|
model: Optional[str] = None,
|
||||||
temperature: float = 0.1,
|
temperature: float = 0.1,
|
||||||
api_key: Optional[str] = None,
|
api_key: Optional[str] = None,
|
||||||
max_tokens: int = 3000,
|
max_tokens: int = 2000,
|
||||||
top_p: float = 0.1,
|
top_p: float = 0.1,
|
||||||
top_k: int = 1,
|
top_k: int = 1,
|
||||||
# Openrouter specific
|
# Openrouter specific
|
||||||
@@ -48,7 +48,7 @@ class BaseLlmConfig(ABC):
|
|||||||
:type temperature: float, optional
|
:type temperature: float, optional
|
||||||
:param api_key: OpenAI API key to be use, defaults to None
|
:param api_key: OpenAI API key to be use, defaults to None
|
||||||
:type api_key: Optional[str], optional
|
:type api_key: Optional[str], optional
|
||||||
:param max_tokens: Controls how many tokens are generated, defaults to 3000
|
:param max_tokens: Controls how many tokens are generated, defaults to 2000
|
||||||
:type max_tokens: int, optional
|
:type max_tokens: int, optional
|
||||||
:param top_p: Controls the diversity of words. Higher values (closer to 1) make word selection more diverse,
|
:param top_p: Controls the diversity of words. Higher values (closer to 1) make word selection more diverse,
|
||||||
defaults to 1
|
defaults to 1
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class AzureOpenAIEmbedding(EmbeddingBase):
|
|||||||
default_headers=default_headers,
|
default_headers=default_headers,
|
||||||
)
|
)
|
||||||
|
|
||||||
def embed(self, text, memory_action:Optional[Literal["add", "search", "update"]] = None):
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
||||||
"""
|
"""
|
||||||
Get the embedding for the given text using OpenAI.
|
Get the embedding for the given text using OpenAI.
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class EmbeddingBase(ABC):
|
|||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def embed(self, text, memory_action:Optional[Literal["add", "search", "update"]]):
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]]):
|
||||||
"""
|
"""
|
||||||
Get the embedding for the given text.
|
Get the embedding for the given text.
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class GoogleGenAIEmbedding(EmbeddingBase):
|
|||||||
|
|
||||||
genai.configure(api_key=api_key)
|
genai.configure(api_key=api_key)
|
||||||
|
|
||||||
def embed(self, text, memory_action:Optional[Literal["add", "search", "update"]] = None):
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
||||||
"""
|
"""
|
||||||
Get the embedding for the given text using Google Generative AI.
|
Get the embedding for the given text using Google Generative AI.
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class HuggingFaceEmbedding(EmbeddingBase):
|
|||||||
|
|
||||||
self.config.embedding_dims = self.config.embedding_dims or self.model.get_sentence_embedding_dimension()
|
self.config.embedding_dims = self.config.embedding_dims or self.model.get_sentence_embedding_dimension()
|
||||||
|
|
||||||
def embed(self, text, memory_action:Optional[Literal["add", "search", "update"]] = None):
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
||||||
"""
|
"""
|
||||||
Get the embedding for the given text using Hugging Face.
|
Get the embedding for the given text using Hugging Face.
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class OllamaEmbedding(EmbeddingBase):
|
|||||||
if not any(model.get("name") == self.config.model for model in local_models):
|
if not any(model.get("name") == self.config.model for model in local_models):
|
||||||
self.client.pull(self.config.model)
|
self.client.pull(self.config.model)
|
||||||
|
|
||||||
def embed(self, text, memory_action:Optional[Literal["add", "search", "update"]] = None):
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
||||||
"""
|
"""
|
||||||
Get the embedding for the given text using Ollama.
|
Get the embedding for the given text using Ollama.
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class OpenAIEmbedding(EmbeddingBase):
|
|||||||
base_url = self.config.openai_base_url or os.getenv("OPENAI_API_BASE")
|
base_url = self.config.openai_base_url or os.getenv("OPENAI_API_BASE")
|
||||||
self.client = OpenAI(api_key=api_key, base_url=base_url)
|
self.client = OpenAI(api_key=api_key, base_url=base_url)
|
||||||
|
|
||||||
def embed(self, text, memory_action:Optional[Literal["add", "search", "update"]] = None):
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
||||||
"""
|
"""
|
||||||
Get the embedding for the given text using OpenAI.
|
Get the embedding for the given text using OpenAI.
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class TogetherEmbedding(EmbeddingBase):
|
|||||||
self.config.embedding_dims = self.config.embedding_dims or 768
|
self.config.embedding_dims = self.config.embedding_dims or 768
|
||||||
self.client = Together(api_key=api_key)
|
self.client = Together(api_key=api_key)
|
||||||
|
|
||||||
def embed(self, text, memory_action:Optional[Literal["add", "search", "update"]] = None):
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
||||||
"""
|
"""
|
||||||
Get the embedding for the given text using OpenAI.
|
Get the embedding for the given text using OpenAI.
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class VertexAIEmbedding(EmbeddingBase):
|
|||||||
self.embedding_types = {
|
self.embedding_types = {
|
||||||
"add": self.config.memory_add_embedding_type or "RETRIEVAL_DOCUMENT",
|
"add": self.config.memory_add_embedding_type or "RETRIEVAL_DOCUMENT",
|
||||||
"update": self.config.memory_update_embedding_type or "RETRIEVAL_DOCUMENT",
|
"update": self.config.memory_update_embedding_type or "RETRIEVAL_DOCUMENT",
|
||||||
"search": self.config.memory_search_embedding_type or "RETRIEVAL_QUERY"
|
"search": self.config.memory_search_embedding_type or "RETRIEVAL_QUERY",
|
||||||
}
|
}
|
||||||
|
|
||||||
credentials_path = self.config.vertex_credentials_json
|
credentials_path = self.config.vertex_credentials_json
|
||||||
@@ -31,7 +31,7 @@ class VertexAIEmbedding(EmbeddingBase):
|
|||||||
|
|
||||||
self.model = TextEmbeddingModel.from_pretrained(self.config.model)
|
self.model = TextEmbeddingModel.from_pretrained(self.config.model)
|
||||||
|
|
||||||
def embed(self, text, memory_action:Optional[Literal["add", "search", "update"]] = None):
|
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
|
||||||
"""
|
"""
|
||||||
Get the embedding for the given text using Vertex AI.
|
Get the embedding for the given text using Vertex AI.
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class OpenAILLM(LLMBase):
|
|||||||
response_format=None,
|
response_format=None,
|
||||||
tools: Optional[List[Dict]] = None,
|
tools: Optional[List[Dict]] = None,
|
||||||
tool_choice: str = "auto",
|
tool_choice: str = "auto",
|
||||||
max_tokens: int = 100,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Generate a response based on the given messages using OpenAI.
|
Generate a response based on the given messages using OpenAI.
|
||||||
@@ -81,7 +80,7 @@ class OpenAILLM(LLMBase):
|
|||||||
"model": self.config.model,
|
"model": self.config.model,
|
||||||
"messages": messages,
|
"messages": messages,
|
||||||
"temperature": self.config.temperature,
|
"temperature": self.config.temperature,
|
||||||
"max_tokens": max_tokens,
|
"max_tokens": self.config.max_tokens,
|
||||||
"top_p": self.config.top_p,
|
"top_p": self.config.top_p,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user