Skip to content

Commit 89af794

Browse files
committed
docs: add content to README (install, running samples etc)
1 parent 407e27a commit 89af794

File tree

1 file changed

+108
-1
lines changed

1 file changed

+108
-1
lines changed

README.md

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,108 @@
1-
# Google ADK chatkit
1+
# OpenAI chatkit support for Google ADK
2+
3+
## Install
4+
5+
```bash
6+
uv add adk-chatkit
7+
```
8+
9+
## Running examples
10+
11+
Make sure you open this repository in vscode `devcontainer` and all dependencies will be setup for you
12+
13+
```bash
14+
# At the root of the repository
15+
# fill in your configuration / settings
16+
cp .env.example .env
17+
```
18+
19+
There is one backend and one frontend that hosts 3 agents (chatkit servers) and their corresponding user interface.
20+
21+
```bash
22+
# Run the backend
23+
uv run poe run-example-backend
24+
```
25+
26+
```bash
27+
# Run the frontend
28+
uv run poe run-example-frontend
29+
```
30+
31+
## Usage
32+
33+
See `examples` for full usage
34+
35+
```python
36+
37+
from adk_chatkit import ADKContext, ADKStore, stream_agent_response
38+
39+
class FactsChatkitServer(ChatKitServer[ADKContext]):
40+
def __init__(
41+
self,
42+
store: ADKStore,
43+
runner_manager: RunnerManager,
44+
settings: Settings,
45+
) -> None:
46+
super().__init__(store)
47+
agent = _make_facts_agent(settings)
48+
self._runner = runner_manager.add_runner(settings.FACTS_APP_NAME, agent)
49+
50+
async def respond(
51+
self,
52+
thread: ThreadMetadata,
53+
item: UserMessageItem | None,
54+
context: ADKContext,
55+
) -> AsyncIterator[ThreadStreamEvent]:
56+
if item is None:
57+
return
58+
59+
if _is_tool_completion_item(item):
60+
return
61+
62+
message_text = _user_message_text(item)
63+
if not message_text:
64+
return
65+
66+
content = genai_types.Content(
67+
role="user",
68+
parts=[genai_types.Part.from_text(text=message_text)],
69+
)
70+
71+
event_stream = self._runner.run_async(
72+
user_id=context["user_id"],
73+
session_id=thread.id,
74+
new_message=content,
75+
run_config=RunConfig(streaming_mode=StreamingMode.SSE),
76+
)
77+
78+
async for event in stream_agent_response(thread, event_stream):
79+
yield event
80+
81+
```
82+
83+
## Examples applications
84+
85+
There are 3 applications (ported from https://github.com/openai/openai-chatkit-advanced-samples)
86+
87+
### Facts & Guide
88+
89+
- Shows Fact Recording
90+
- Displays Weather using Widget
91+
- Theme Switching
92+
93+
http://localhost:5173/guide
94+
95+
### Customer Support
96+
97+
- Airline Reservation Management
98+
- Change Seat
99+
- Add bags
100+
101+
http://localhost:5171/customer-support
102+
103+
### Knowledge Assistant
104+
105+
- Answers questions based on files and vector store
106+
- Shows files and citations
107+
108+
http://localhost:5171/knowledge

0 commit comments

Comments
 (0)