Skip to content

7.1.3 🎉

Latest

Choose a tag to compare

@poissoncorp poissoncorp released this 21 Nov 00:09
71607f3

Starting with 7.1.2, the Python client gained full AI Agents support.

7.1.3 takes that further: it syncs the API with RavenDB 7.1.3, smooths out the Agent experience (streaming, action handling, metrics), and adds connection string operations (including Vertex AI) plus a bunch of reliability fixes.

If you’re new to Agents, start here:

PyPi link: https://pypi.org/project/ravendb/7.1.3/

Highlights

AI Agents

  • New stream(...) method lets you push Agent responses to your UI as they arrive, ChatGPT-style.
  • You can register actions via conventient API and decide what happens when the model calls something you didn’t wire up, using handle(...), receive(...) and on_unhandled_action.
  • AI conversation run() returns rich stats (token usage, elapsed time, etc.) inside AiAnswer.
    ai_agent_result = store.ai.add_or_update_agent(ai_agent_configuration)

    ai_agent = store.ai.get_agents(ai_agent_result.identifier)

    chat = store.ai.conversation(
        ai_agent.ai_agents[0].identifier,
        "chats/",
        AiConversationCreationOptions(expiration_in_sec=3600).add_parameter("user", "users/15-A")
    )
    chat.on_unhandled_action = lambda args: print(f"Unhandled action: {args.action.name}")

    # Handle SendNotification action tool request
    chat.handle(
        "SendNotification",
        lambda args: f"Notification sent to {args['recipients']}", # mock sending notification
        AiHandleErrorStrategy.SEND_ERRORS_TO_MODEL,
    )

    while True:
        chat.set_user_prompt(input())

        def _on_chunk(answer: str):
            print(answer, end="")

        result = chat.stream("response", _on_chunk)
        print(result.usage)
        print(result.elapsed)

Vertex AI connection strings

You can now configure Vertex AI as an AI connection string, side-by-side with OpenAI and others:

cs_name = "vertex-demo"

vertex = VertexSettings(
    model="gemini-1.5-pro",
    google_credentials_json='{"project_id":"demo-vertex-project"}',
    location="us-central1",
    ai_version=VertexAIVersion.V1,
)

ai_cs = AiConnectionString(
    name=cs_name,
    identifier=cs_name,
    vertex_settings=vertex,
    model_type=AiModelType.CHAT,
)

store.maintenance.send(PutConnectionStringOperation(ai_cs))

Later you can point your AI Agent configuration at connection_string_name="vertex-demo" and talk to Vertex via the same Agents API.


Connection String CRUD (including AI)

New operations let you Add / Update / Get / Delete all connection string types (including AI ones), plus a dedicated RemoveConnectionStringByNameOperation that matches other SDKs.

Minimal CRUD example:

# Put
store.maintenance.send(PutConnectionStringOperation(ai_cs))

# Get single AI connection string
get_result = store.maintenance.send(
    GetConnectionStringsOperation(cs_name, ConnectionStringType.AI)
)
ai_map = get_result.ai_connection_strings
ai_cs_loaded = ai_map[cs_name]

# Remove by name
store.maintenance.send(
    RemoveConnectionStringByNameOperation(ConnectionStringType.AI, cs_name)
)

Fixes

  • Fix: zstd-compression module prevented storing the data by yh-0 #254
  • Topology & network error handling by @redknightlois #249

PRs

  • README.md should use order_by_descending() by @Scooletz in #246
  • RDBC-935 Add Connection String Operations by @yh-0 in #247
  • RDBC-949: Refactors is_read_request to a method by @redknightlois in #250
  • RDBC-948: Ensure topology handling matches C# Client. by @redknightlois in #249
  • RDBC-940 v7.1 Zstd-compression data prevents simple store. by @yh-0 in #251
  • RDBC-964 Fix SSLError in https test by @yh-0 in #256
  • RDBC-954 Python client: fix Connection String R/W Bugs (OLAP + AI) by @yh-0 in #255
  • RDBC-934 Sync to 7.1.3 by @poissoncorp in #258
  • RDBC-934 7.1.3 C# API parity by @poissoncorp in #259