mirror of
https://github.com/sudoxreboot/groqd
synced 2026-04-14 03:26:35 +00:00
Increase default max tokens and fetch size
This commit is contained in:
parent
e665cd2589
commit
4051f0120e
3 changed files with 9 additions and 6 deletions
|
|
@ -57,6 +57,7 @@ from .const import (
|
|||
DEFAULT_SEARXNG_SAFESEARCH,
|
||||
DEFAULT_SEARXNG_LANGUAGE,
|
||||
DEFAULT_AUTO_FETCH_URLS,
|
||||
DEFAULT_FETCH_MAX_CHARS,
|
||||
DOMAIN,
|
||||
)
|
||||
from .const import DEFAULT_MAX_TOKENS, CONF_MAX_TOKENS
|
||||
|
|
@ -209,7 +210,7 @@ class GroqdOptionsFlow(OptionsFlow):
|
|||
CONF_MAX_TOKENS,
|
||||
description={"suggested_value": options.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS)},
|
||||
default=options.get(CONF_MAX_TOKENS, DEFAULT_MAX_TOKENS),
|
||||
): NumberSelector(NumberSelectorConfig(min=1, max=8192, step=1)),
|
||||
): NumberSelector(NumberSelectorConfig(min=1, max=16384, step=1)),
|
||||
vol.Optional(
|
||||
CONF_TEMPERATURE,
|
||||
description={"suggested_value": options.get(CONF_TEMPERATURE, DEFAULT_TEMPERATURE)},
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ CONF_AUTO_FETCH_URLS = "auto_fetch_urls"
|
|||
|
||||
DEFAULT_CHAT_MODEL = "meta-llama/llama-4-maverick-17b-128e-instruct"
|
||||
DEFAULT_CONTEXT_MESSAGES = 20
|
||||
DEFAULT_MAX_TOKENS = 512
|
||||
DEFAULT_MAX_TOKENS = 4096
|
||||
DEFAULT_TEMPERATURE = 1.0
|
||||
DEFAULT_TOP_P = 1.0
|
||||
DEFAULT_FREQUENCY_PENALTY = 0.0
|
||||
|
|
@ -45,3 +45,4 @@ DEFAULT_SEARXNG_URL = "http://127.0.0.1:8800"
|
|||
DEFAULT_SEARXNG_SAFESEARCH = 1
|
||||
DEFAULT_SEARXNG_LANGUAGE = "en"
|
||||
DEFAULT_AUTO_FETCH_URLS = True
|
||||
DEFAULT_FETCH_MAX_CHARS = 12000
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ from .const import (
|
|||
DEFAULT_SEARXNG_SAFESEARCH,
|
||||
DEFAULT_SEARXNG_URL,
|
||||
DEFAULT_AUTO_FETCH_URLS,
|
||||
DEFAULT_FETCH_MAX_CHARS,
|
||||
DEFAULT_TEMPERATURE,
|
||||
DEFAULT_TOOL_CHOICE,
|
||||
DEFAULT_TOP_P,
|
||||
|
|
@ -153,7 +154,7 @@ def _fetch_tool() -> ChatCompletionToolParam:
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"url": {"type": "string"},
|
||||
"max_chars": {"type": "integer", "default": 4000},
|
||||
"max_chars": {"type": "integer", "default": 12000},
|
||||
},
|
||||
"required": ["url"],
|
||||
},
|
||||
|
|
@ -400,7 +401,7 @@ class GroqdConversationEntity(
|
|||
fetched_chunks = []
|
||||
for url in urls:
|
||||
try:
|
||||
fetched = await _run_fetch(self.hass, url, 2000)
|
||||
fetched = await _run_fetch(self.hass, url, DEFAULT_FETCH_MAX_CHARS)
|
||||
fetched_chunks.append(
|
||||
f"URL: {fetched['url']}\\nCONTENT: {fetched['text']}"
|
||||
)
|
||||
|
|
@ -522,11 +523,11 @@ class GroqdConversationEntity(
|
|||
tool_response = {"error": type(err).__name__, "error_text": str(err)}
|
||||
elif tool_name == "fetch_url":
|
||||
url = tool_args.get("url", "")
|
||||
max_chars = tool_args.get("max_chars", 4000)
|
||||
max_chars = tool_args.get("max_chars", DEFAULT_FETCH_MAX_CHARS)
|
||||
try:
|
||||
max_chars = int(max_chars)
|
||||
except (TypeError, ValueError):
|
||||
max_chars = 4000
|
||||
max_chars = DEFAULT_FETCH_MAX_CHARS
|
||||
try:
|
||||
tool_response = await _run_fetch(self.hass, url, max_chars)
|
||||
except Exception as err:
|
||||
|
|
|
|||
Loading…
Reference in a new issue