1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
{
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
hatch-vcs,
hatchling,
# dependencies
htmltools,
# optional-dependencies
anthropic,
chatlas,
google-generativeai,
langchain-core,
ollama,
openai,
pydantic,
tokenizers,
# tests
pillow,
playwright,
pytest-playwright,
pytestCheckHook,
shiny,
shinychat,
}:
buildPythonPackage rec {
pname = "shinychat";
version = "0.2.8";
pyproject = true;
src = fetchFromGitHub {
owner = "posit-dev";
repo = "shinychat";
tag = "py/v${version}";
hash = "sha256-thdLaZ+rnD8yumxhjXOLhufcSBD0oNKOWSxxDdJ9tNU=";
};
build-system = [
hatch-vcs
hatchling
];
pythonRemoveDeps = [
"shiny" # circular dependency
];
dependencies = [
htmltools
];
optional-dependencies = {
providers = [
anthropic
chatlas
google-generativeai
langchain-core
ollama
openai
pydantic
tokenizers
];
};
pythonImportsCheck = [
# ImportError: cannot import name 'Chat' from partially initialized module 'shinychat' (most likely due to a circular import)
# "shinychat"
];
nativeCheckInputs = [
pillow
playwright
pytest-playwright
pytestCheckHook
shiny
]
++ lib.concatAttrValues optional-dependencies;
disabledTests = [
# AssertionError: assert False
"test_as_langchain_message"
# AssertionError: assert 'AIMessage' == 'BaseMessage'
"test_langchain_normalization"
# RuntimeError: Failed to download a default tokenizer
"test_chat_message_trimming"
# Require running a headless chromium browser
"test_latest_stream_result"
"test_validate_chat"
"test_validate_chat_append_user_message"
"test_validate_chat_append_user_message"
"test_validate_chat_basic"
"test_validate_chat_basic"
"test_validate_chat_basic"
"test_validate_chat_basic_error"
"test_validate_chat_input_suggestion"
"test_validate_chat_message_stream_context"
"test_validate_chat_shiny_output"
"test_validate_chat_shiny_output"
"test_validate_chat_stream_result"
"test_validate_chat_transform"
"test_validate_chat_transform_assistant"
"test_validate_chat_transform_assistant"
"test_validate_chat_update_user_input"
"test_validate_stream_basic"
"test_validate_stream_shiny_ui"
];
# Circular dependency with shiny
doCheck = false;
passthru.tests.pytest = shinychat.overridePythonAttrs {
doCheck = true;
};
meta = {
description = "Chat UI component for Shiny";
homepage = "https://posit-dev.github.io/shinychat";
downloadPage = "https://github.com/posit-dev/shinychat";
changelog = "https://github.com/posit-dev/shinychat/releases/tag/${src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}
|