Skip to content

Commit f2f5279

Browse files
release 0.2.22 (#299)
1 parent cdad50b commit f2f5279

File tree

5 files changed

+5
-124
lines changed

5 files changed

+5
-124
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "veadk-python"
3-
version = "0.2.21"
3+
version = "0.2.22"
44
description = "Volcengine agent development kit, integrations with Volcengine cloud services."
55
readme = "README.md"
66
requires-python = ">=3.10"

veadk/configs/database_configs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class RedisConfig(BaseSettings):
7575

7676
port: int = 6379
7777

78+
username: str | None = None
79+
7880
password: str = ""
7981

8082
db: int = 0

veadk/knowledgebase/backends/redis_backend.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def model_post_init(self, __context: Any) -> None:
8888
host=self.redis_config.host,
8989
port=self.redis_config.port,
9090
db=self.redis_config.db,
91+
username=self.redis_config.username,
9192
password=self.redis_config.password,
9293
)
9394

veadk/runner.py

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -288,128 +288,6 @@ class Runner(ADKRunner):
288288
This class wraps the parent ``run_async`` at initialization to insert media
289289
upload and post-run handling. If you override the underlying ``run_async``,
290290
ensure it remains compatible with this interception logic.
291-
292-
Examples:
293-
### Text-only interaction
294-
295-
```python
296-
import asyncio
297-
298-
from veadk import Agent, Runner
299-
300-
agent = Agent()
301-
302-
runner = Runner(agent=agent)
303-
304-
response = asyncio.run(runner.run(messages="北京的天气怎么样?"))
305-
306-
print(response)
307-
```
308-
309-
### Send multimodal data to agent
310-
311-
Currently, VeADK support send multimodal data (i.e., text with images) to agent, and invoke the corresponding model to do tasks.
312-
313-
!!! info "Note for multimodal running"
314-
315-
When sending multimodal data to agent, the model of agent must support multimodal data processing. For example, `doubao-1-6`.
316-
317-
```python
318-
import asyncio
319-
320-
from veadk import Agent, Runner
321-
from veadk.types import MediaMessage
322-
323-
agent = Agent(model_name="doubao-seed-1-6-250615")
324-
325-
runner = Runner(agent=agent)
326-
327-
message = MediaMessage(
328-
text="Describe the image",
329-
media="https://...", # <-- replace here with an image from web
330-
)
331-
response = asyncio.run(runner.run(messages=message))
332-
333-
print(response)
334-
```
335-
336-
### Run with run_async
337-
338-
You are recommand that **using `run_async` in production to invoke agent**. During running, the loop will throw out `event`, you can process each `event` according to your requirements.
339-
340-
```python
341-
import uuid
342-
343-
from google.genai import types
344-
from veadk import Agent, Runner
345-
346-
APP_NAME = "app"
347-
USER_ID = "user"
348-
349-
agent = Agent()
350-
351-
runner = Runner(agent=agent, app_name=APP_NAME)
352-
353-
354-
async def main(message: types.Content, session_id: str):
355-
# before running, you should create a session first
356-
await runner.short_term_memory.create_session(
357-
app_name=APP_NAME, user_id=USER_ID, session_id=session_id
358-
)
359-
360-
async for event in runner.run_async(
361-
user_id=USER_ID,
362-
session_id=session_id,
363-
new_message=message,
364-
):
365-
# process event here
366-
print(event)
367-
368-
369-
if __name__ == "__main__":
370-
import asyncio
371-
372-
message = types.Content(parts=[types.Part(text="Hello")], role="user")
373-
session_id = str(uuid.uuid1())
374-
asyncio.run(main(message=message, session_id=session_id))
375-
```
376-
377-
### Custom your message
378-
379-
You can custom your message content, as Google provides some basic types to build and custom agent's input. For example, you can build a message with a text and several images.
380-
381-
```python
382-
from google.genai import types
383-
384-
# build message with a text
385-
message = types.Content(parts=[types.Part(text="Hello")], role="user")
386-
387-
# build message with a text and an image
388-
message = types.Content(
389-
parts=[
390-
types.Part(text="Hello!"),
391-
types.Part(
392-
inline_data=types.Blob(display_name="foo.png", data=..., mime_type=...)
393-
),
394-
],
395-
role="user",
396-
)
397-
398-
# build image with several text and several images
399-
message = types.Content(
400-
parts=[
401-
types.Part(text="Hello!"),
402-
types.Part(text="Please help me to describe the following images."),
403-
types.Part(
404-
inline_data=types.Blob(display_name="foo.png", data=..., mime_type=...)
405-
),
406-
types.Part(
407-
inline_data=types.Blob(display_name="bar.png", data=..., mime_type=...)
408-
),
409-
],
410-
role="user",
411-
)
412-
```
413291
"""
414292

415293
def __init__(

veadk/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
VERSION = "0.2.21"
15+
VERSION = "0.2.22"

0 commit comments

Comments
 (0)