v2.17.0 (#822)
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Hdandria <henri.dandria@mistral.ai> Co-authored-by: Ivana Dunisijevic <ivana.dunisijevic@mistral.ai> Co-authored-by: Jean Burellier <sheplu@users.noreply.github.com> Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai> Co-authored-by: Mert Unsal <mert.unsal@mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Val <102326092+vdeva@users.noreply.github.com> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: renovate-mistral[bot] <253709520+renovate-mistral[bot]@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
564a14365e
commit
6bedf271ce
223 changed files with 10533 additions and 6947 deletions
|
|
@ -14,13 +14,20 @@ import pytest
|
|||
import respx
|
||||
|
||||
from tests.conftest import build_test_agent_loop, build_test_vibe_config
|
||||
from tests.constants import CHAT_COMPLETIONS_PATH
|
||||
from tests.mock.utils import mock_llm_chunk
|
||||
from tests.stubs.fake_backend import FakeBackend
|
||||
from vibe.core.config import ModelConfig, ProviderConfig, VibeConfig
|
||||
from vibe.core.llm.backend.generic import GenericBackend, OpenAIAdapter
|
||||
from vibe.core.llm.backend.mistral import MistralBackend, MistralMapper, ParsedContent
|
||||
from vibe.core.llm.format import APIToolFormatHandler
|
||||
from vibe.core.types import AssistantEvent, LLMMessage, ReasoningEvent, Role
|
||||
from vibe.core.types import (
|
||||
AssistantEvent,
|
||||
LLMMessage,
|
||||
ReasoningEvent,
|
||||
Role,
|
||||
UserDisplayContentMetadata,
|
||||
)
|
||||
|
||||
|
||||
def make_config() -> VibeConfig:
|
||||
|
|
@ -194,7 +201,7 @@ class TestGenericBackendReasoningContent:
|
|||
}
|
||||
|
||||
with respx.mock(base_url=base_url) as mock_api:
|
||||
mock_api.post("/v1/chat/completions").mock(
|
||||
mock_api.post(CHAT_COMPLETIONS_PATH).mock(
|
||||
return_value=httpx.Response(status_code=200, json=json_response)
|
||||
)
|
||||
provider = ProviderConfig(
|
||||
|
|
@ -228,7 +235,7 @@ class TestGenericBackendReasoningContent:
|
|||
]
|
||||
|
||||
with respx.mock(base_url=base_url) as mock_api:
|
||||
mock_api.post("/v1/chat/completions").mock(
|
||||
mock_api.post(CHAT_COMPLETIONS_PATH).mock(
|
||||
return_value=httpx.Response(
|
||||
status_code=200,
|
||||
stream=httpx.ByteStream(stream=b"\n\n".join(chunks)),
|
||||
|
|
@ -455,6 +462,49 @@ class TestReasoningFieldNameConversion:
|
|||
assert payload["messages"][0]["reasoning_content"] == "Thinking..."
|
||||
assert "reasoning_state" not in payload["messages"][0]
|
||||
|
||||
def test_prepare_request_excludes_user_display_content_from_completions_payload(
|
||||
self,
|
||||
):
|
||||
adapter = OpenAIAdapter()
|
||||
provider = ProviderConfig(
|
||||
name="test",
|
||||
api_base="https://api.example.com/v1",
|
||||
api_key_env_var="API_KEY",
|
||||
)
|
||||
|
||||
request = adapter.prepare_request(
|
||||
model_name="test-model",
|
||||
messages=[
|
||||
LLMMessage(
|
||||
role=Role.user,
|
||||
content="Look at app.ts",
|
||||
user_display_content=UserDisplayContentMetadata(
|
||||
version="1.0.0",
|
||||
host="mistral-vscode",
|
||||
content=[
|
||||
{"type": "text", "text": "Look at "},
|
||||
{
|
||||
"type": "workspace_mention",
|
||||
"kind": "file",
|
||||
"uri": "file:///repo/src/app.ts",
|
||||
"name": "app.ts",
|
||||
},
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
temperature=0.2,
|
||||
tools=None,
|
||||
max_tokens=None,
|
||||
tool_choice=None,
|
||||
enable_streaming=False,
|
||||
provider=provider,
|
||||
)
|
||||
|
||||
payload = json.loads(request.body)
|
||||
|
||||
assert payload["messages"][0] == {"role": "user", "content": "Look at app.ts"}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_complete_with_custom_reasoning_field_name(self):
|
||||
base_url = "https://api.example.com"
|
||||
|
|
@ -478,7 +528,7 @@ class TestReasoningFieldNameConversion:
|
|||
}
|
||||
|
||||
with respx.mock(base_url=base_url) as mock_api:
|
||||
mock_api.post("/v1/chat/completions").mock(
|
||||
mock_api.post(CHAT_COMPLETIONS_PATH).mock(
|
||||
return_value=httpx.Response(status_code=200, json=json_response)
|
||||
)
|
||||
provider = ProviderConfig(
|
||||
|
|
@ -515,7 +565,7 @@ class TestReasoningFieldNameConversion:
|
|||
]
|
||||
|
||||
with respx.mock(base_url=base_url) as mock_api:
|
||||
mock_api.post("/v1/chat/completions").mock(
|
||||
mock_api.post(CHAT_COMPLETIONS_PATH).mock(
|
||||
return_value=httpx.Response(
|
||||
status_code=200,
|
||||
stream=httpx.ByteStream(stream=b"\n\n".join(chunks)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue