repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
jackmpcollins/magentic | import collections.abc
import json
import typing
from collections import OrderedDict
from typing import Annotated, Any, Generic, TypeVar, get_origin
import pytest
from pydantic import BaseModel, Field, create_model
from magentic._pydantic import ConfigDict, with_config
from magentic.chat_model.function_schema import ... | json_schema | assert | variable | tests/test_function_schema.py | test_any_function_schema | 138 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | "test" | assert | string_literal | tests/chat_model/test_message.py | test_placeholder_coercion | 40 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING
import pytest
from magentic._chat import Chat
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
UserMessage,
)
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.s... | UserMessage(content="two") | assert | func_call | tests/test_chat.py | test_chat_last_message | 31 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | tuple[int | str, ...]) | assert_* | complex_expr | tests/test_function_call.py | test_parallel_function_call_call | 88 | null | |
jackmpcollins/magentic | import asyncio
from collections.abc import Iterator
from typing import Annotated, Any
import litellm
import pytest
from litellm.integrations.custom_logger import CustomLogger
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.base import ToolSchemaParseError
from magentic.chat_model.litellm_chat_... | { "my-extra-header": "foo" } | assert | collection | tests/chat_model/test_litellm_chat_model.py | test_litellm_chat_model_extra_headers | 61 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | message_repr | assert | variable | tests/chat_model/test_message.py | test_message_repr | 85 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | equal | assert | variable | tests/test_function_call.py | test_function_call_eq | 57 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | ToolSchemaParseError) | pytest.raises | variable | tests/chat_model/test_openai_chat_model.py | test_openai_chat_model_complete_raises_tool_schema_parse_error | 406 | null | |
jackmpcollins/magentic | from unittest.mock import AsyncMock, Mock
import pytest
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.function_call import FunctionCall
from magentic.prompt_chain import MaxFunctionCallsError, prompt_chain
def test_prompt_chain_max_calls():
mock_function = Mock()
mock_fu... | 1 | assert | numeric_literal | tests/test_prompt_chain.py | test_prompt_chain_max_calls | 61 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | (3, "hello") | assert | collection | tests/test_function_call.py | test_parallel_function_call_call | 89 | null | |
jackmpcollins/magentic | import pytest
from typing_extensions import assert_type
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.message import Placeholder, UserMessage
from magentic.chat_model.openai_chat_model import (
OpenaiChatModel,
message_to_openai_message,
)
from magentic.chatpr... | bytes) | assert_* | variable | tests/test_vision.py | test_user_image_message_format_placeholder | 30 | null | |
jackmpcollins/magentic | from inspect import getdoc
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import BaseModel
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
ImageBytes,
Placeholder,
SystemMessage,
ToolResultMessage,
UserMessage,
)
from magentic.chatp... | "Hello!" | assert | string_literal | tests/test_chatprompt.py | test_chatpromptfunction_call | 107 | null | |
jackmpcollins/magentic | from collections.abc import AsyncIterator
import pytest
from magentic import AsyncStreamedStr, StreamedStr
from magentic.streaming import (
CachedAsyncIterable,
CachedIterable,
aapply,
adropwhile,
agroupby,
aiter_streamed_json_array,
apeek,
apply,
async_iter,
atakewhile,
az... | "First [...]" | assert | string_literal | tests/test_streaming.py | test_streamed_str_truncate | 187 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | "gpt-4" | assert | string_literal | tests/test_backend.py | test_backend_openai_chat_model | 56 | null | |
jackmpcollins/magentic | import os
from typing import Annotated
import openai
import pytest
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._streamed_response import AsyncStreamedResponse, StreamedResponse
from magentic.chat_model.base import ToolSchemaParseError
from magent... | 1 | assert | numeric_literal | tests/chat_model/test_openrouter_chat_model.py | test_openrouter_chat_model_complete_streamed_response | 71 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | "Test arg." | assert | string_literal | tests/test_prompt_function.py | test_promptfunction_format | 27 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | chat_model | assert | variable | tests/test_backend.py | test_chat_model_context | 96 | null | |
jackmpcollins/magentic | from typing import Annotated
from unittest.mock import ANY
import pytest
from inline_snapshot import snapshot
from pydantic import AfterValidator, BaseModel
from magentic._streamed_response import AsyncStreamedResponse, StreamedResponse
from magentic.chat_model.anthropic_chat_model import (
AnthropicChatModel,
... | 0 | assert | numeric_literal | tests/chat_model/test_anthropic_chat_model.py | test_anthropic_chat_model_complete_usage | 275 | null | |
jackmpcollins/magentic | import pytest
from typing_extensions import assert_type
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.message import Placeholder, UserMessage
from magentic.chat_model.openai_chat_model import (
OpenaiChatModel,
message_to_openai_message,
)
from magentic.chatpr... | { "role": "user", "content": [ { "type": "image_url", "image_url": {"url": "https://example.com/image.jpg", "detail": "auto"}, } ], } | assert | collection | tests/test_vision.py | test_message_to_openai_message_user_image_message_str | 37 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | "openai" | assert | string_literal | tests/test_backend.py | test_backend_openai_chat_model | 58 | null | |
jackmpcollins/magentic | from inspect import getdoc
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import BaseModel
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
ImageBytes,
Placeholder,
SystemMessage,
ToolResultMessage,
UserMessage,
)
from magentic.chatp... | ["stop"] | assert | collection | tests/test_chatprompt.py | test_chatpromptfunction_call | 113 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING
import pytest
from magentic._chat import Chat
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
UserMessage,
)
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.s... | FunctionResultMessage(3, plus_1_2) | assert | func_call | tests/test_chat.py | test_exec_function_call | 70 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | "sk-1234567890" | assert | string_literal | tests/test_backend.py | test_backend_anthropic_chat_model | 21 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | 100 | assert | numeric_literal | tests/chat_model/test_openai_chat_model.py | test_openai_chat_model_max_completion_tokens_property | 284 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | 0 | assert | numeric_literal | tests/chat_model/test_openai_chat_model.py | test_openai_chat_model_complete_usage | 369 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | [1, 2, 3, 4, 5] | assert | collection | tests/test_prompt_function.py | test_decorator_ignore_multiple_tool_calls | 176 | null | |
jackmpcollins/magentic | from unittest.mock import AsyncMock, Mock
import pytest
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.function_call import FunctionCall
from magentic.prompt_chain import MaxFunctionCallsError, prompt_chain
def test_prompt_chain_max_calls():
mock_function = Mock()
mock_fu... | MaxFunctionCallsError) | pytest.raises | variable | tests/test_prompt_chain.py | test_prompt_chain_max_calls | 58 | null | |
jackmpcollins/magentic | import asyncio
from collections.abc import Iterator
from typing import Annotated, Any
import litellm
import pytest
from litellm.integrations.custom_logger import CustomLogger
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.base import ToolSchemaParseError
from magentic.chat_model.litellm_chat_... | ToolSchemaParseError) | pytest.raises | variable | tests/chat_model/test_litellm_chat_model.py | test_litellm_chat_model_complete_raises_tool_schema_parse_error | 97 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | AsyncParallelFunctionCall[int]) | assert_* | complex_expr | tests/test_function_call.py | test_async_parallel_function_call_call | 108 | null | |
jackmpcollins/magentic | from typing_extensions import assert_type
from magentic.formatting import BulletedDict, BulletedList, NumberedDict, NumberedList
def test_numbered_dict():
items = NumberedDict({"foo": 1, "bar": 2, "baz": 3})
assert_type(items, | NumberedDict[str, int]) | assert_* | complex_expr | tests/test_formatting.py | test_numbered_dict | 26 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | 1024 | assert | numeric_literal | tests/test_backend.py | test_backend_mistral_chat_model | 40 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | NotImplementedError) | pytest.raises | variable | tests/chat_model/test_openai_chat_model.py | test_message_to_openai_message_raises | 242 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | 1 | assert | numeric_literal | tests/test_prompt_function.py | test_promptfunction_call | 53 | null | |
jackmpcollins/magentic | import asyncio
from collections.abc import Iterator
from typing import Annotated, Any
import litellm
import pytest
from litellm.integrations.custom_logger import CustomLogger
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.base import ToolSchemaParseError
from magentic.chat_model.litellm_chat_... | "openai" | assert | string_literal | tests/chat_model/test_litellm_chat_model.py | test_litellm_chat_model_custom_llm_provider | 82 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | Placeholder[Country]) | assert_* | complex_expr | tests/chat_model/test_message.py | test_placeholder_format | 33 | null | |
jackmpcollins/magentic | from typing import Annotated
from unittest.mock import ANY
import pytest
from inline_snapshot import snapshot
from pydantic import AfterValidator, BaseModel
from magentic._streamed_response import AsyncStreamedResponse, StreamedResponse
from magentic.chat_model.anthropic_chat_model import (
AnthropicChatModel,
... | None | assert | none_literal | tests/chat_model/test_anthropic_chat_model.py | test_anthropic_chat_model_complete_streamed_response | 376 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING
import pytest
from magentic._chat import Chat
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
UserMessage,
)
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.s... | FunctionResultMessage(7, plus_3_4) | assert | func_call | tests/test_chat.py | test_exec_function_call_parallel_function_call | 89 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | ValidationError) | pytest.raises | variable | tests/chat_model/test_message.py | test_image_bytes_invalid | 105 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | UserMessage[str]) | assert_* | complex_expr | tests/chat_model/test_message.py | test_user_message_format | 113 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | 10 | assert | numeric_literal | tests/test_backend.py | test_backend_anthropic_chat_model | 23 | null | |
jackmpcollins/magentic | import os
from typing import Annotated
import openai
import pytest
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._streamed_response import AsyncStreamedResponse, StreamedResponse
from magentic.chat_model.base import ToolSchemaParseError
from magent... | 0 | assert | numeric_literal | tests/chat_model/test_openrouter_chat_model.py | test_openrouter_chat_model_complete_usage | 115 | null | |
jackmpcollins/magentic | import json
import os
from collections.abc import Iterator
from itertools import count
from pathlib import Path
from typing import Any
from uuid import UUID
import pytest
from dotenv import load_dotenv
from pytest_mock import MockerFixture
from vcr import VCR
from vcr.request import Request
def _load_dotenv():
""... | "000000000" | assert | string_literal | tests/conftest.py | test_mock_create_unique_id | 106 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | Country) | assert_* | variable | tests/chat_model/test_message.py | test_assistant_message_format_placeholder | 221 | null | |
jackmpcollins/magentic | import collections.abc
import json
import typing
from collections import OrderedDict
from typing import Annotated, Any, Generic, TypeVar, get_origin
import pytest
from pydantic import BaseModel, Field, create_model
from magentic._pydantic import ConfigDict, with_config
from magentic.chat_model.function_schema import ... | "return_user_int" | assert | string_literal | tests/test_function_schema.py | test_base_model_function_schema_generic_model | 550 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | openai.OpenAIError) | pytest.raises | complex_expr | tests/chat_model/test_openai_chat_model.py | test_openai_chat_model_api_key | 260 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | "claude-2" | assert | string_literal | tests/test_backend.py | test_backend_litellm_chat_model | 74 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | arguments | assert | variable | tests/test_function_call.py | test_function_call_arguments | 69 | null | |
jackmpcollins/magentic | from typing_extensions import assert_type
from magentic.formatting import BulletedDict, BulletedList, NumberedDict, NumberedList
def test_bulleted_list():
items = BulletedList(["foo", "bar", "baz"])
assert_type(items, | BulletedList[str]) | assert_* | complex_expr | tests/test_formatting.py | test_bulleted_list | 8 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | None | assert | none_literal | tests/chat_model/test_openai_chat_model.py | test_openai_chat_model_complete_streamed_response | 327 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | ParallelFunctionCall[int | str]) | assert_* | complex_expr | tests/test_function_call.py | test_parallel_function_call_call | 86 | null | |
jackmpcollins/magentic | import json
import os
from collections.abc import Iterator
from itertools import count
from pathlib import Path
from typing import Any
from uuid import UUID
import pytest
from dotenv import load_dotenv
from pytest_mock import MockerFixture
from vcr import VCR
from vcr.request import Request
def _load_dotenv():
""... | "000000001" | assert | string_literal | tests/conftest.py | test_mock_create_unique_id | 107 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | 2 | assert | numeric_literal | tests/test_prompt_function.py | test_decorator_return_dict | 103 | null | |
jackmpcollins/magentic | from typing import Annotated
from unittest.mock import ANY
import pytest
from inline_snapshot import snapshot
from pydantic import AfterValidator, BaseModel
from magentic._streamed_response import AsyncStreamedResponse, StreamedResponse
from magentic.chat_model.anthropic_chat_model import (
AnthropicChatModel,
... | "This is a test PDF." | assert | string_literal | tests/chat_model/test_anthropic_chat_model.py | test_anthropic_chat_model_complete_document_bytes | 389 | null | |
jackmpcollins/magentic | from collections.abc import AsyncIterator
import pytest
from magentic import AsyncStreamedStr, StreamedStr
from magentic.streaming import (
CachedAsyncIterable,
CachedIterable,
aapply,
adropwhile,
agroupby,
aiter_streamed_json_array,
apeek,
apply,
async_iter,
atakewhile,
az... | [0, 1, 2] | assert | collection | tests/test_streaming.py | test_apply | 32 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | ["test"] | assert | collection | tests/chat_model/test_message.py | test_placeholder_coercion | 42 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | ["stop"] | assert | collection | tests/test_prompt_function.py | test_promptfunction_call | 58 | null | |
jackmpcollins/magentic | from inspect import getdoc
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import BaseModel
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
ImageBytes,
Placeholder,
SystemMessage,
ToolResultMessage,
UserMessage,
)
from magentic.chatp... | [str, bool] | assert | collection | tests/test_chatprompt.py | test_chatpromptfunction_call | 112 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING
import pytest
from magentic._chat import Chat
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
UserMessage,
)
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.s... | TypeError) | pytest.raises | variable | tests/test_chat.py | test_exec_function_call_raises | 100 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | "Test custom." | assert | string_literal | tests/test_prompt_function.py | test_promptfunction_format_custom_type | 38 | null | |
jackmpcollins/magentic | from typing_extensions import assert_type
from magentic.formatting import BulletedDict, BulletedList, NumberedDict, NumberedList
def test_numbered_list():
items = NumberedList(["foo", "bar", "baz"])
assert_type(items, NumberedList[str])
assert f"{items}" == | "1. foo\n2. bar\n3. baz" | assert | string_literal | tests/test_formatting.py | test_numbered_list | 15 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | "This is the docstring." | assert | string_literal | tests/test_prompt_function.py | test_decorator_return_str | 68 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | "Hello!" | assert | string_literal | tests/test_prompt_function.py | test_promptfunction_call | 52 | null | |
jackmpcollins/magentic | from inspect import getdoc
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import BaseModel
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
ImageBytes,
Placeholder,
SystemMessage,
ToolResultMessage,
UserMessage,
)
from magentic.chatp... | [AssistantMessage(Country(name="USA"))] | assert | collection | tests/test_chatprompt.py | test_chatpromptfunction_format_with_placeholder | 93 | null | |
jackmpcollins/magentic | from collections.abc import AsyncIterator
import pytest
from magentic import AsyncStreamedStr, StreamedStr
from magentic.streaming import (
CachedAsyncIterable,
CachedIterable,
aapply,
adropwhile,
agroupby,
aiter_streamed_json_array,
apeek,
apply,
async_iter,
atakewhile,
az... | [2, 2] | assert | collection | tests/test_streaming.py | test_agroupby_skip | 121 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING
import pytest
from magentic._chat import Chat
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
UserMessage,
)
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.s... | [UserMessage(content="Hello")] | assert | collection | tests/test_chat.py | test_chat_add_message | 26 | null | |
jackmpcollins/magentic | from typing import Annotated
from unittest.mock import ANY
import pytest
from inline_snapshot import snapshot
from pydantic import AfterValidator, BaseModel
from magentic._streamed_response import AsyncStreamedResponse, StreamedResponse
from magentic.chat_model.anthropic_chat_model import (
AnthropicChatModel,
... | ToolSchemaParseError) | pytest.raises | variable | tests/chat_model/test_anthropic_chat_model.py | test_anthropic_chat_model_complete_raises_tool_schema_parse_error | 312 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | str) | assert_* | variable | tests/chat_model/test_message.py | test_user_message_format | 114 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | 42 | assert | numeric_literal | tests/test_backend.py | test_backend_mistral_chat_model | 41 | null | |
jackmpcollins/magentic | from collections.abc import AsyncIterator
import pytest
from magentic import AsyncStreamedStr, StreamedStr
from magentic.streaming import (
CachedAsyncIterable,
CachedIterable,
aapply,
adropwhile,
agroupby,
aiter_streamed_json_array,
apeek,
apply,
async_iter,
atakewhile,
az... | [] | assert | collection | tests/test_streaming.py | test_streamed_str_iter | 176 | null | |
jackmpcollins/magentic | from typing_extensions import assert_type
from magentic.formatting import BulletedDict, BulletedList, NumberedDict, NumberedList
def test_bulleted_dict():
items = BulletedDict({"foo": 1, "bar": 2, "baz": 3})
assert_type(items, | BulletedDict[str, int]) | assert_* | complex_expr | tests/test_formatting.py | test_bulleted_dict | 20 | null | |
jackmpcollins/magentic | import os
from typing import Annotated
import openai
import pytest
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._streamed_response import AsyncStreamedResponse, StreamedResponse
from magentic.chat_model.base import ToolSchemaParseError
from magent... | openai.OpenAIError) | pytest.raises | complex_expr | tests/chat_model/test_openrouter_chat_model.py | test_openrouter_chat_model_api_key | 22 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | 2 | assert | numeric_literal | tests/test_backend.py | test_backend_anthropic_chat_model | 24 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | (3, 7) | assert | collection | tests/test_function_call.py | test_async_parallel_function_call_call | 111 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | Country(name="USA") | assert | func_call | tests/chat_model/test_message.py | test_placeholder_format | 35 | null | |
jackmpcollins/magentic | import pytest
from typing_extensions import assert_type
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.message import Placeholder, UserMessage
from magentic.chat_model.openai_chat_model import (
OpenaiChatModel,
message_to_openai_message,
)
from magentic.chatpr... | str) | assert_* | variable | tests/test_vision.py | test_user_image_message_format_noop | 20 | null | |
jackmpcollins/magentic | from collections.abc import AsyncIterator
import pytest
from magentic import AsyncStreamedStr, StreamedStr
from magentic.streaming import (
CachedAsyncIterable,
CachedIterable,
aapply,
adropwhile,
agroupby,
aiter_streamed_json_array,
apeek,
apply,
async_iter,
atakewhile,
az... | "Hello World" | assert | string_literal | tests/test_streaming.py | test_streamed_str_str | 182 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING
import pytest
from magentic._chat import Chat
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
UserMessage,
)
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.s... | 4 | assert | numeric_literal | tests/test_chat.py | test_exec_function_call_parallel_function_call | 87 | null | |
jackmpcollins/magentic | from typing import Annotated
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import UserMessage
from magentic.chat_model.openai_chat... | "Ireland" | assert | string_literal | tests/chat_model/test_retry_chat_model.py | test_retry_chat_model_complete_openai | 30 | null | |
BrainBlend-AI/atomic-agents | from atomic_agents.context import SystemPromptGenerator, BaseDynamicContextProvider
def test_system_prompt_generator_default_initialization():
generator = SystemPromptGenerator()
assert generator.background == | ["This is a conversation with a helpful and friendly AI assistant."] | assert | collection | atomic-agents/tests/context/test_system_prompt_generator.py | test_system_prompt_generator_default_initialization | 15 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from aiohttp import ClientSession
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.searxng_search import ( # noqa: E402
SearXNGSearchTool,
SearXNGSearchToolInputSchema,
Sea... | "Result with Published Date - (Published 2022-01-01)" | assert | string_literal | atomic-forge/tools/searxng_search/tests/test_searxng_search.py | test_searxng_search_tool_with_metadata_and_published_date | 149 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from aiohttp import ClientSession
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.searxng_search import ( # noqa: E402
SearXNGSearchTool,
SearXNGSearchToolInputSchema,
Sea... | "Valid Result" | assert | string_literal | atomic-forge/tools/searxng_search/tests/test_searxng_search.py | test_searxng_search_tool_missing_fields | 99 | null | |
BrainBlend-AI/atomic-agents | from atomic_agents.context import SystemPromptGenerator, BaseDynamicContextProvider
def test_system_prompt_generator_default_initialization():
generator = SystemPromptGenerator()
assert generator.background == ["This is a conversation with a helpful and friendly AI assistant."]
assert generator.steps == []... | [ "Always respond using the proper JSON schema.", "Always use the available additional information and context to enhance the response.", ] | assert | collection | atomic-agents/tests/context/test_system_prompt_generator.py | test_system_prompt_generator_default_initialization | 17 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from types import SimpleNamespace
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.tavily_search import ( # noqa: E402
TavilySearchTool,
TavilySearchToolInputSchema,
Tavily... | mock_answer | assert | variable | atomic-forge/tools/tavily_search/tests/test_tavily_seach.py | test_tavily_search_tool_include_answer | 237 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, MagicMock
from datetime import datetime
from youtube_transcript_api import NoTranscriptFound, TranscriptsDisabled
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.youtube_transcript_scraper import ( # noq... | str(excinfo.value) | assert | func_call | atomic-forge/tools/youtube_transcript_scraper/tests/test_youtube_transcript_scraper.py | test_youtube_transcript_tool_no_transcript | 111 | null | |
BrainBlend-AI/atomic-agents | import uuid
from pydantic import BaseModel
import pytest
from atomic_agents import BaseIOSchema
from atomic_agents.utils import format_tool_message
def test_format_tool_message_without_tool_id():
tool_call = MockToolCall(param1="test", param2=42)
result = format_tool_message(tool_call)
assert isinstance(... | 36 | assert | numeric_literal | atomic-agents/tests/utils/test_format_tool_message.py | test_format_tool_message_without_tool_id | 35 | null | |
BrainBlend-AI/atomic-agents | import unittest
from unittest.mock import patch, Mock
import requests
import sys
import os
from bs4 import BeautifulSoup
from readability import Document
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.webpage_scraper import ( # noqa: E402
WebpageScraperTool,
Webp... | 2_000_000) | self.assertEqual | numeric_literal | atomic-forge/tools/webpage_scraper/tests/test_webpage_scraper.py | test_tool_config | TestWebpageScraperTool | 320 | null |
BrainBlend-AI/atomic-agents | from pydantic import BaseModel
from atomic_agents import BaseToolConfig, BaseTool, BaseIOSchema
def test_base_tool_initialization_without_type_parameters():
tool = MockTool()
assert tool.tool_name == "BaseIOSchema"
assert tool.tool_description == "Base schema for input/output in the Atomic Agents framework... | BaseIOSchema | assert | variable | atomic-agents/tests/base/test_base_tool.py | test_base_tool_initialization_without_type_parameters | 44 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from aiohttp import ClientSession
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.searxng_search import ( # noqa: E402
SearXNGSearchTool,
SearXNGSearchToolInputSchema,
Sea... | "Result with Metadata - (Published 2021-01-01)" | assert | string_literal | atomic-forge/tools/searxng_search/tests/test_searxng_search.py | test_searxng_search_tool_with_metadata_and_published_date | 148 | null | |
BrainBlend-AI/atomic-agents | from atomic_agents.context import SystemPromptGenerator, BaseDynamicContextProvider
def test_context_provider_repr():
provider = MockContextProvider("Test Provider", "Test Info")
assert repr(provider) == | "Test Info" | assert | string_literal | atomic-agents/tests/context/test_system_prompt_generator.py | test_context_provider_repr | 114 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from types import SimpleNamespace
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.tavily_search import ( # noqa: E402
TavilySearchTool,
TavilySearchToolInputSchema,
Tavily... | str(excinfo.value) | assert | func_call | atomic-forge/tools/tavily_search/tests/test_tavily_seach.py | test_tavily_search_tool_error | 204 | null | |
BrainBlend-AI/atomic-agents | from atomic_agents.context import SystemPromptGenerator, BaseDynamicContextProvider
def test_system_prompt_generator_custom_initialization():
background = ["Custom background"]
steps = ["Step 1", "Step 2"]
output_instructions = ["Custom instruction"]
context_providers = {
"provider1": MockConte... | context_providers | assert | variable | atomic-agents/tests/context/test_system_prompt_generator.py | test_system_prompt_generator_custom_initialization | 44 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from types import SimpleNamespace
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.tavily_search import ( # noqa: E402
TavilySearchTool,
TavilySearchToolInputSchema,
Tavily... | "Sync Test Result" | assert | string_literal | atomic-forge/tools/tavily_search/tests/test_tavily_seach.py | test_tavily_search_tool_sync_run_method | 104 | null | |
BrainBlend-AI/atomic-agents | import uuid
from pydantic import BaseModel
import pytest
from atomic_agents import BaseIOSchema
from atomic_agents.utils import format_tool_message
def test_format_tool_message_with_different_tool():
class AnotherToolCall(BaseModel):
"""Another tool schema"""
field1: bool
field2: float
... | '{"field1": true, "field2": 3.14}' | assert | string_literal | atomic-agents/tests/utils/test_format_tool_message.py | test_format_tool_message_with_different_tool | 54 | null | |
BrainBlend-AI/atomic-agents | from pydantic import BaseModel
from atomic_agents import BaseToolConfig, BaseTool, BaseIOSchema
def test_base_tool_with_config():
config = BaseToolConfig(title="Custom Title", description="Custom description")
tool = MockTool[MockInputSchema, MockOutputSchema](config=config)
assert tool.tool_name == "Custo... | "Custom description" | assert | string_literal | atomic-agents/tests/base/test_base_tool.py | test_base_tool_with_config | 57 | null | |
BrainBlend-AI/atomic-agents | import pytest
from pydantic import BaseModel
import asyncio
from atomic_agents.connectors.mcp import (
fetch_mcp_tools,
fetch_mcp_resources,
fetch_mcp_prompts,
create_mcp_orchestrator_schema,
fetch_mcp_attributes_with_schema,
fetch_mcp_tools_async,
fetch_mcp_resources_async,
fetch_mcp_pr... | 1 | assert | numeric_literal | atomic-agents/tests/connectors/mcp/test_mcp_factory.py | test_fetch_mcp_tools_with_definitions_http | 81 | null | |
BrainBlend-AI/atomic-agents | import unittest
from unittest.mock import patch, Mock
import requests
import sys
import os
from bs4 import BeautifulSoup
from readability import Document
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.webpage_scraper import ( # noqa: E402
WebpageScraperTool,
Webp... | "\n") | self.assertEqual | string_literal | atomic-forge/tools/webpage_scraper/tests/test_webpage_scraper.py | test_clean_markdown_empty_content | TestWebpageScraperTool | 326 | null |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from aiohttp import ClientSession
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.searxng_search import ( # noqa: E402
SearXNGSearchTool,
SearXNGSearchToolInputSchema,
Sea... | 3 | assert | numeric_literal | atomic-forge/tools/searxng_search/tests/test_searxng_search.py | test_searxng_search_tool_with_metadata_and_published_date | 147 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from aiohttp import ClientSession
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.searxng_search import ( # noqa: E402
SearXNGSearchTool,
SearXNGSearchToolInputSchema,
Sea... | "Result without Dates" | assert | string_literal | atomic-forge/tools/searxng_search/tests/test_searxng_search.py | test_searxng_search_tool_with_metadata_and_published_date | 150 | null | |
BrainBlend-AI/atomic-agents | import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
from types import SimpleNamespace
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.tavily_search import ( # noqa: E402
TavilySearchTool,
TavilySearchToolInputSchema,
Tavily... | "Result 1" | assert | string_literal | atomic-forge/tools/tavily_search/tests/test_tavily_seach.py | test_tavily_search_tool_include_answer | 233 | null | |
BrainBlend-AI/atomic-agents | import unittest
from unittest.mock import patch, Mock
import requests
import sys
import os
from bs4 import BeautifulSoup
from readability import Document
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from tool.webpage_scraper import ( # noqa: E402
WebpageScraperTool,
Webp... | 45) | self.assertEqual | numeric_literal | atomic-forge/tools/webpage_scraper/tests/test_webpage_scraper.py | test_tool_config | TestWebpageScraperTool | 318 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.