Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat(tf): gpu runners and prod memory_repos (#9283)

Kian Jones7eb85707b155
diff --git a/letta/services/provider_manager.py b/letta/services/provider_manager.py
index 2f66d1408..c8a3a1aeb 100644
--- a/letta/services/provider_manager.py
+++ b/letta/services/provider_manager.py
@@ -991,10 +991,13 @@ class ProviderManager:
# Get the default max_output_tokens from the provider (provider-specific logic)
max_tokens = typed_provider.get_default_max_output_tokens(model.name)
- # Determine the model endpoint - use provider's base_url if set,
- # otherwise use provider-specific defaults
+ # Determine the model endpoint - use provider's OpenAI-compatible base_url if available,
+ # otherwise fall back to raw base_url or provider-specific defaults
- if typed_provider.base_url:
+ if hasattr(typed_provider, "openai_compat_base_url"):
+ # For providers like ollama/vllm/lmstudio that need /v1 appended for OpenAI compatibility
+ model_endpoint = typed_provider.openai_compat_base_url
+ elif typed_provider.base_url:
model_endpoint = typed_provider.base_url
elif provider.provider_type == ProviderType.chatgpt_oauth:
# ChatGPT OAuth uses the ChatGPT backend API, not a generic endpoint pattern
diff --git a/tests/integration_test_send_message_v2.py b/tests/integration_test_send_message_v2.py
index ce267e7de..7f040eb26 100644
--- a/tests/integration_test_send_message_v2.py
+++ b/tests/integration_test_send_message_v2.py
@@ -207,12 +207,15 @@ def assert_tool_call_response(
# Reasoning is non-deterministic, so don't throw if missing
pass
- # Special case for claude-sonnet-4-5-20250929, opus-4.1, and zai which can generate an extra AssistantMessage before tool call
- if (
- ("claude-sonnet-4-5-20250929" in model_handle or "claude-opus-4-1" in model_handle or model_settings.get("provider_type") == "zai")
- and index < len(messages)
- and isinstance(messages[index], AssistantMessage)
- ):
+ # Special case for models that can generate an extra AssistantMessage before tool call
+ # (claude-sonnet-4-5, opus-4.1, zai, and self-hosted models like ollama/qwen3 with thinking)
+ is_extra_assistant_model = (
+ "claude-sonnet-4-5-20250929" in model_handle
+ or "claude-opus-4-1" in model_handle
+ or model_settings.get("provider_type") == "zai"
+ or model_handle.startswith(("ollama/", "vllm/"))
+ )
+ if is_extra_assistant_model and index < len(messages) and isinstance(messages[index], AssistantMessage):
# Skip the extra AssistantMessage and move to the next message
index += 1
otid_suffix += 1
@@ -441,6 +444,10 @@ def get_expected_message_count_range(
if model_settings.get("provider_type") == "zai":
expected_range += 1
+ # Self-hosted models (ollama/vllm) may emit an extra AssistantMessage with thinking content
+ if model_handle.startswith(("ollama/", "vllm/")):
+ expected_range += 1
+
if tool_call:
# tool call and tool return messages
expected_message_count += 2
@@ -561,13 +568,16 @@ async def agent_state(client: AsyncLetta) -> AgentState:
"""
dice_tool = await client.tools.upsert_from_function(func=roll_dice)
+ initial_model = TESTED_MODEL_CONFIGS[0][0] if TESTED_MODEL_CONFIGS else "openai/gpt-4o"
+ initial_embedding = os.getenv("EMBEDDING_HANDLE", "openai/text-embedding-3-small")
+
agent_state_instance = await client.agents.create(
agent_type="letta_v1_agent",
name="test_agent",
include_base_tools=False,
tool_ids=[dice_tool.id],
- model="openai/gpt-4o",
- embedding="openai/text-embedding-3-small",
+ model=initial_model,
+ embedding=initial_embedding,
tags=["test"],
)
yield agent_state_instance
@@ -677,6 +687,9 @@ async def test_parallel_tool_calls(
if provider_type in ["google_ai", "google_vertex"]:
pytest.skip("Gemini models are flaky for this test so we disable them for now")
+ if model_handle.startswith("vllm"):
+ pytest.skip("vLLM Qwen3 tool call parsers incompatible with streaming parallel tool calls")
+
# Update model_settings to enable parallel tool calling
modified_model_settings = model_settings.copy()
modified_model_settings["parallel_tool_calls"] = True
@@ -1076,6 +1089,10 @@ async def test_conversation_non_streaming_raw_http(
assert "assistant_message" in message_types, f"Expected assistant_message in {message_types}"
+ os.getenv("LLM_CONFIG_FILE", "").startswith(("ollama", "vllm")),
+ reason="Structured output not supported on self-hosted providers in CI",
+)
@pytest.mark.parametrize(
"model_handle,provider_type",
[
diff --git a/tests/model_settings/ollama.json b/tests/model_settings/ollama.json
index 9382a68ca..bd905dac5 100644
--- a/tests/model_settings/ollama.json
+++ b/tests/model_settings/ollama.json
@@ -1,9 +1,9 @@
{
- "handle": "ollama/qwen2.5:7b",
+ "handle": "ollama/qwen3:8b",
"model_settings": {
"provider_type": "openai",
- "temperature": 1.0,
+ "temperature": 0.7,
"max_output_tokens": 4096,
- "parallel_tool_calls": false
+ "parallel_tool_calls": true
}
}
diff --git a/tests/model_settings/vllm.json b/tests/model_settings/vllm.json
new file mode 100644
index 000000000..0ee9492b4
--- /dev/null
+++ b/tests/model_settings/vllm.json
@@ -0,0 +1,9 @@
+{
+ "handle": "vllm/Qwen/Qwen3-32B-AWQ",
+ "model_settings": {
+ "provider_type": "openai",
+ "temperature": 0.7,
+ "max_output_tokens": 4096,
+ "parallel_tool_calls": true
+ }
+}