Skip to content

Commit f44048f

Browse files
committed
Added support for attributes in DBMS_CLOUD_AI.generate
1 parent 804cc6b commit f44048f

7 files changed

Lines changed: 412 additions & 39 deletions

File tree

‎doc/source/user_guide/actions.rst‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ The following actions can be performed using ``select_ai``:
5757
Action methods
5858
==============
5959

60+
Request-specific profile attributes can be supplied with the optional
61+
``attributes`` mapping. For example, override ``additional_instructions`` for
62+
a single chat request:
63+
64+
.. code-block:: python
65+
66+
response = profile.chat(
67+
prompt="Write sample Python code to build and test a regression model",
68+
attributes={
69+
"additional_instructions": (
70+
"Return executable code as plain text without Markdown fences."
71+
)
72+
},
73+
)
74+
6075
.. list-table:: Action to method mapping
6176
:header-rows: 1
6277
:widths: 30 35 35

‎doc/source/user_guide/profile_attributes.rst‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ Attribute groups
7474
- Tunes model generation behavior.
7575
* - ``conversation``
7676
- Enables conversation history for context-aware chat workflows.
77+
* - ``additional_instructions``
78+
- Provides persistent guidance, business rules, or response constraints
79+
for requests that use the profile.
7780
* - ``source_language``, ``target_language``
7881
- Set default languages for ``Profile.translate()`` and
7982
``AsyncProfile.translate()``. If no source language is configured or
@@ -134,5 +137,22 @@ responses:
134137
stop_tokens='[";"]',
135138
)
136139
140+
Additional instructions
141+
=======================
142+
143+
Use ``additional_instructions`` for guidance that should apply to every
144+
request made with a profile:
145+
146+
.. code-block:: python
147+
148+
attributes = select_ai.ProfileAttributes(
149+
provider=provider,
150+
credential_name="my_oci_ai_profile_key",
151+
additional_instructions="Return concise, executable Python code.",
152+
)
153+
154+
For guidance that applies to only one request, pass an ``attributes`` mapping
155+
to an action method instead of changing the saved profile.
156+
137157
.. autoclass:: select_ai.ProfileAttributes
138158
:members:

0 commit comments

Comments
 (0)