ratexp 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ratexp-0.1.0.dist-info/METADATA +57 -0
- ratexp-0.1.0.dist-info/RECORD +6 -0
- ratexp-0.1.0.dist-info/WHEEL +5 -0
- ratexp-0.1.0.dist-info/licenses/LICENSE +236 -0
- ratexp-0.1.0.dist-info/top_level.txt +1 -0
- ratexp.py +164 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ratexp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: RateXp SDK: qualify your agent with human evals, asked where the run happened.
|
|
5
|
+
Author: Hikmet Beyoglu
|
|
6
|
+
License-Expression: LicenseRef-RateXp-Source-Available-1.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/HikmetB1/RateXp
|
|
8
|
+
Project-URL: Documentation, https://ratexp-core.azurewebsites.net/guide/docs/sdk/
|
|
9
|
+
Keywords: ai-agents,human-evals,feedback,llm,ratings
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# ratexp: the RateXp SDK for Python
|
|
18
|
+
|
|
19
|
+
<!-- quick-start:start: copied from the root README.md by ../base/copy_readme_quick_start.py; edit it there -->
|
|
20
|
+
A developer builds their own agent or agentic app, for example, a chatbot, a pull request
|
|
21
|
+
review agent, an agent that summarizes Jira tickets, etc. The developer ships the agent with
|
|
22
|
+
the RateXp SDK. At the end of a run, the agent asks its users the human evals where the run
|
|
23
|
+
happened, and the users answer in their own words.
|
|
24
|
+
|
|
25
|
+
1. **Install the SDK:** Type the command, or add the package to the dependencies of the
|
|
26
|
+
agent (`requirements.txt` or `package.json`).
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install ratexp
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. **Ask for a rating at the end of a run:** Post the question where the person is, then
|
|
33
|
+
send the reply of the person to RateXp.
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from ratexp import RateXp
|
|
37
|
+
|
|
38
|
+
rx = RateXp(agent="acme-review-bot")
|
|
39
|
+
|
|
40
|
+
# At the end of the run: post the question where the person is.
|
|
41
|
+
post_comment(rx.rating_question())
|
|
42
|
+
|
|
43
|
+
# When the person replies:
|
|
44
|
+
rating = rx.send_reply(reply_text, session_id="pr-42", messages=messages)
|
|
45
|
+
if rating is None:
|
|
46
|
+
... # The reply answers no eval: handle the reply as usual.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- **The code of the agent:** These names stand for the code that the agent already has:
|
|
50
|
+
- **Python:** `post_comment`, `reply_text` and `messages`.
|
|
51
|
+
- **The reply:** RateXp stores one rating for each eval that the person answered. RateXp
|
|
52
|
+
stores the messages only when the person says so.
|
|
53
|
+
<!-- quick-start:end -->
|
|
54
|
+
|
|
55
|
+
- **Guide:** [SDK: qualify your agent with human evals](https://ratexp-core.azurewebsites.net/guide/docs/sdk/).
|
|
56
|
+
- **License:** The [RateXp Source Available License 1.0](./LICENSE). RateXp is not open
|
|
57
|
+
source.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
ratexp.py,sha256=a3zr0rzGt1rExzA-M2pHkq8gZTtfyFoMOxwOiGelVMQ,7195
|
|
2
|
+
ratexp-0.1.0.dist-info/licenses/LICENSE,sha256=Iy6E3UfnFGdLIo5y0ZwY0aq6CcNwZG9McJudUoEozoY,22640
|
|
3
|
+
ratexp-0.1.0.dist-info/METADATA,sha256=G8n8f2dRDYqNEM_rgRmNMoUlaelxfr9QwkzeQO6AUa0,2325
|
|
4
|
+
ratexp-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
5
|
+
ratexp-0.1.0.dist-info/top_level.txt,sha256=XyvcdGiSkj0A0yNmFvl5y5ylrwoUsooHQEsHHNEpkbI,7
|
|
6
|
+
ratexp-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# RateXp Source Available License 1.0
|
|
2
|
+
|
|
3
|
+
Copyright © 2026 Hikmet Beyoglu. All rights reserved.
|
|
4
|
+
|
|
5
|
+
## 1. License Parameters
|
|
6
|
+
|
|
7
|
+
**Licensed Software:** RateXp, including its source code, binaries, documentation, and modifications distributed under this License.
|
|
8
|
+
|
|
9
|
+
**Licensor:** Hikmet Beyoglu
|
|
10
|
+
|
|
11
|
+
This License applies to versions of the Licensed Software distributed under it. The trial permissions granted in Sections 4.1 and 4.2 expire at the end of the Trial Period defined below, which does not restart for a new version. The Hosted Service permissions in Section 5 are separate from those trial permissions.
|
|
12
|
+
|
|
13
|
+
## 2. Definitions
|
|
14
|
+
|
|
15
|
+
**You** means the individual or legal entity exercising rights under this License.
|
|
16
|
+
|
|
17
|
+
**Organization** means a company, partnership, institution, government body, nonprofit organization, or other legal or organizational entity on whose behalf You exercise rights under this License. Personal activity is not activity on behalf of an Organization solely because You are employed by or affiliated with it.
|
|
18
|
+
|
|
19
|
+
**Trial Use** means exercising the source inspection permissions in Section 4.1 or compiling, running, modifying, or deploying the Licensed Software under Section 4.2 for Your own personal use or an Organization's internal use, including evaluation, testing, and actual internal workflows. All Trial Use is subject to the applicable Trial Period.
|
|
20
|
+
|
|
21
|
+
**Trial Period** means a single period of 30 consecutive calendar days. For personal use, it begins on the date You first exercise a permission granted by Section 4.1 or Section 4.2, including source inspection or copying under Section 4.1. For use on behalf of an Organization, one shared period begins on the date the first person does so on its behalf and applies to all of that Organization's users, copies, and instances. Sections 4.1 and 4.2 share this period; inspecting the source and later deploying it do not provide separate trials. Hosted Service use under Section 5 does not start this period. A new version, copy, fork, installation, account, device, deployment, or user does not restart or extend it.
|
|
22
|
+
|
|
23
|
+
**Production Use** means any use of the Licensed Software for an actual business, organizational, operational, customer-facing, revenue-generating, monitoring, analytics, development workflow, or other ongoing purpose beyond Trial Use.
|
|
24
|
+
|
|
25
|
+
Production Use includes internal use that provides operational or business value even when the Licensed Software is not exposed to external customers.
|
|
26
|
+
|
|
27
|
+
**Client Components** means the hook scripts, skill files, and settings snippets that the Licensor provides for installation on a user's machine or inside a skill to send ratings, comments, and session data to a RateXp service. They also include browser code delivered by the Hosted Service as needed to access and use that service. Client Components do not include the RateXp server software.
|
|
28
|
+
|
|
29
|
+
**Hosted Service** means a RateXp service operated by the Licensor, such as https://ratexp-app.azurewebsites.net and https://ratexp-core.azurewebsites.net.
|
|
30
|
+
|
|
31
|
+
**Commercial License** means a separate written license agreement issued by the Licensor permitting uses not allowed by this License.
|
|
32
|
+
|
|
33
|
+
## 3. License Grant
|
|
34
|
+
|
|
35
|
+
Subject to the terms of this License, the Licensor grants You a limited, worldwide, royalty-free, non-exclusive, non-transferable license to:
|
|
36
|
+
|
|
37
|
+
1. access and inspect the source code;
|
|
38
|
+
2. make private copies of the Licensed Software for permitted uses;
|
|
39
|
+
3. compile and run the Licensed Software; and
|
|
40
|
+
4. modify the Licensed Software and create private derivative works for permitted uses.
|
|
41
|
+
|
|
42
|
+
These rights may only be exercised within the permissions in Sections 4 and 5. This License itself grants the limited trial permissions in Sections 4.1 and 4.2 and the Hosted Service permissions in Section 5. Continued exercise of the trial permissions after the Trial Period requires a separate Commercial License already in effect, subject to the independent rights preserved in Section 18.
|
|
43
|
+
|
|
44
|
+
No general right to redistribute, publish, mirror, sublicense, or provide the Licensed Software or its source code to third parties is granted. All permissions are subject to the restrictions in Sections 7 and 8 and the independent rights preserved in Section 18.
|
|
45
|
+
|
|
46
|
+
## 4. Permitted Use
|
|
47
|
+
|
|
48
|
+
### 4.1 Source Inspection Trial License
|
|
49
|
+
|
|
50
|
+
Under this License, You receive a limited, royalty-free license to access, inspect, review, and make private copies of the source code for inspection and review only during the applicable Trial Period, subject to Sections 7 and 8. Copies must remain on devices or private infrastructure controlled by You or the Organization on whose behalf You act. These permissions are part of the 30-day trial license and do not grant continuing source access or use rights after that period.
|
|
51
|
+
|
|
52
|
+
When the Trial Period ends, the permissions granted by this Section expire. You must obtain a Commercial License from the Licensor before continuing to exercise them. This expiry is subject to the independent rights preserved in Section 18.
|
|
53
|
+
|
|
54
|
+
You may not publish or mirror the source code, or provide it to third parties, without the Licensor's prior written permission, except for the limited internal access allowed by Section 8 and the independent rights preserved in Section 18. Compiling, executing, or modifying the Licensed Software, or operating a RateXp service, requires permission under Section 4.2, Section 5, or a Commercial License.
|
|
55
|
+
|
|
56
|
+
### 4.2 Local and Organizational Trial
|
|
57
|
+
|
|
58
|
+
Under the trial license granted by this License, You may compile, run, modify, and deploy the Licensed Software only if all of the following conditions are satisfied:
|
|
59
|
+
|
|
60
|
+
1. These activities are solely Trial Use within the applicable Trial Period. Personal use and actual internal organizational workflows, including data ingestion, are permitted during that period.
|
|
61
|
+
2. The Licensed Software runs on infrastructure controlled by You or the Organization on whose behalf You act. Local devices, virtual machines, containers, company servers, shared internal environments, and cloud deployments are permitted.
|
|
62
|
+
3. Access to the running software is limited to You for personal use or to the Organization's employees and contractors acting on its behalf for internal use. Multiple users and devices may participate, and network access between them is permitted.
|
|
63
|
+
4. All users and instances acting on behalf of the same Organization share its single Trial Period. Adding users, moving to another server, or creating another instance does not provide another trial.
|
|
64
|
+
5. The Licensed Software is not offered to third parties as a product or service, or incorporated into a product or service supplied to third parties.
|
|
65
|
+
6. Copies and modifications remain private, and all access and use comply with Sections 7 and 8. The trial does not grant permission for public redistribution, competitive use, or AI model training prohibited by those Sections.
|
|
66
|
+
|
|
67
|
+
When the Trial Period ends, You and the Organization must stop compiling, running, modifying, and deploying the Licensed Software under this Section, including ingesting data into those instances and using its Client Components with them, unless a Commercial License permitting continued use is already in effect. The source inspection permissions in Section 4.1 expire at the same time. Use of the Licensor's Hosted Service under Section 5 remains permitted, and the independent rights preserved in Section 18 remain unaffected.
|
|
68
|
+
|
|
69
|
+
## 5. Hosted Service and Clients
|
|
70
|
+
|
|
71
|
+
The trial limits in Sections 4.1, 4.2, and 6 do not apply to the permissions expressly granted in this Section. Under this License, without a trial time limit and for any number of people within any Organization, You may:
|
|
72
|
+
|
|
73
|
+
1. access and use the Hosted Service, including its dashboard, and submit ratings, comments, session data, and other supported data for personal or organizational purposes, subject to the service terms described below;
|
|
74
|
+
2. download, install, privately copy, and run the Client Components as needed to access and use the Hosted Service, including during normal organizational workflows; and
|
|
75
|
+
3. make private changes to the Client Components needed for installation or configuration for Your own use or the Organization's internal use, subject to Sections 7 and 8.
|
|
76
|
+
|
|
77
|
+
The Client Components must retain applicable copyright and license notices. Publishing, redistributing, or bundling them in packages supplied to third parties requires the Licensor's prior written permission under Section 8. You may instead share links to the Licensor's official downloads. Internal installation for authorized users under this Section remains permitted.
|
|
78
|
+
|
|
79
|
+
Client Components used under this Section may connect only to the Hosted Service. Using them to connect to another RateXp service requires permission under Section 4.2 or a Commercial License.
|
|
80
|
+
|
|
81
|
+
Data submission to the Hosted Service is free of charge and has no data-volume limit or trial time limit under this License. This permission applies to both individuals and Organizations, including normal organizational workflows. Access to and use of the Hosted Service, including data submission, are subject to its available capacity.
|
|
82
|
+
|
|
83
|
+
The Licensor's [Terms of Service](./TERMS.md) govern account requirements, privacy, acceptable use, and service operation. They do not change the free data-submission permission granted by this Section. This License does not guarantee continuous service availability.
|
|
84
|
+
|
|
85
|
+
Deploying or operating another instance of the RateXp server software is governed by Section 4.2 or a Commercial License. Using the Hosted Service does not start, extend, or restart the period permitted for that separate instance.
|
|
86
|
+
|
|
87
|
+
## 6. Uses Requiring a Commercial License
|
|
88
|
+
|
|
89
|
+
Except for activities expressly permitted by Sections 4.1, 4.2, and 5, or expressly covered by the Licensor's written permission under Section 7 or 8, a Commercial License from the Licensor is required before You may:
|
|
90
|
+
|
|
91
|
+
- use the Licensed Software in production;
|
|
92
|
+
- deploy the Licensed Software for internal organizational use;
|
|
93
|
+
- operate the Licensed Software as a hosted service, SaaS offering, managed service, API, or other service for third parties;
|
|
94
|
+
- incorporate the Licensed Software into a commercial product or service;
|
|
95
|
+
- use the Licensed Software to provide services to customers or other third parties;
|
|
96
|
+
- use the Licensed Software as part of an ongoing corporate development, engineering, analytics, monitoring, evaluation, or operational workflow;
|
|
97
|
+
- continue exercising the source inspection or private copying permissions in Section 4.1 after the applicable Trial Period;
|
|
98
|
+
- continue running or using any local or organizational instance after the applicable Trial Period; or
|
|
99
|
+
- otherwise use the Licensed Software outside the permissions in Sections 4 and 5.
|
|
100
|
+
|
|
101
|
+
A Commercial License may grant any or all of these rights under separately agreed terms.
|
|
102
|
+
|
|
103
|
+
Written permission under Section 7 or 8 authorizes only the activities it expressly covers. It does not extend the Trial Period or grant other rights unless it expressly says so.
|
|
104
|
+
|
|
105
|
+
## 7. Use Restrictions
|
|
106
|
+
|
|
107
|
+
The restrictions in this Section apply to the permissions in Sections 4 and 5, including during the Trial Period, subject to the independent rights preserved in Section 18.
|
|
108
|
+
|
|
109
|
+
### 7.1 No Circumvention
|
|
110
|
+
|
|
111
|
+
You may not divide an Organization into teams, departments, subsidiaries, accounts, environments, machines, or individual users for the purpose of avoiding the limitations of this License.
|
|
112
|
+
|
|
113
|
+
Affiliated entities under common control will be treated as one Organization where they coordinate their use of the Licensed Software. Control means the power to direct an entity's management or policies, directly or indirectly, through ownership, voting rights, contract, or otherwise.
|
|
114
|
+
|
|
115
|
+
### 7.2 Competitive Use
|
|
116
|
+
|
|
117
|
+
Without the Licensor's prior written permission, You may not use the Licensed Software, its source code, or modified versions to develop, train, improve, operate, or provide a product or service that substantially reproduces RateXp's core functionality or competes with RateXp.
|
|
118
|
+
|
|
119
|
+
Private modifications and internal instances used solely as permitted by Section 4 are allowed and are not, by themselves, prohibited competitive use. This allowance does not authorize using them to develop or support a separate competing product or service. This restriction concerns use of the Licensed Software or its source code; it does not prohibit independent development without such use, subject to any intellectual property rights that apply independently of this License.
|
|
120
|
+
|
|
121
|
+
### 7.3 AI and Machine Learning Training
|
|
122
|
+
|
|
123
|
+
Without the Licensor's prior written permission, You may not use the source code of the Licensed Software, including modified versions or portions of that source code, as training data for machine learning or artificial intelligence models. This restriction includes pretraining, fine-tuning, and further training of existing models, as well as supplying the source code for those purposes or authorizing others to use it for those purposes.
|
|
124
|
+
|
|
125
|
+
To the extent applicable law permits a rights reservation, the Licensor expressly reserves rights to reproduce or extract that source code for text and data mining for such training purposes. No such permission is granted by this License. Mandatory exceptions preserved by Section 18 remain unaffected.
|
|
126
|
+
|
|
127
|
+
## 8. Private Modifications and Restrictions on Redistribution
|
|
128
|
+
|
|
129
|
+
You may make private copies and modifications only for uses permitted by this License.
|
|
130
|
+
|
|
131
|
+
Except for the limited internal access described below, or as independently permitted under Section 18, You may not redistribute, publish, mirror, sublicense, or otherwise provide the Licensed Software, its source code, binaries, or modified versions to any third party without the Licensor's prior written permission. This restriction includes public repositories, mirrors, downloadable packages, and public contributions containing the Licensed Software or modifications to it.
|
|
132
|
+
|
|
133
|
+
Private copying and access by an Organization's employees and contractors acting solely on its behalf are permitted only as necessary for the uses expressly allowed by Sections 4 and 5. The Organization must ensure that those persons are bound to comply with this License, keep the copies under its control, and do not use or disclose them for independent or third-party purposes. This limited internal permission does not grant sublicensing rights or restart the Trial Period.
|
|
134
|
+
|
|
135
|
+
Any private copy or modified version must retain applicable copyright and license notices. Unless the Licensor's written permission expressly provides otherwise, any copy or modified version whose redistribution the Licensor authorizes must also:
|
|
136
|
+
|
|
137
|
+
- retain this License;
|
|
138
|
+
- retain applicable copyright notices;
|
|
139
|
+
- clearly identify material modifications made by You; and
|
|
140
|
+
- remain subject to the same use restrictions contained in this License.
|
|
141
|
+
|
|
142
|
+
Preserving notices does not itself authorize redistribution. An authorized recipient receives only the rights expressly granted by this License or a separate written license from the Licensor. Authorized redistribution does not restart or extend a Trial Period that has already begun for that recipient or its Organization.
|
|
143
|
+
|
|
144
|
+
You may not represent a modified version as an official RateXp release.
|
|
145
|
+
|
|
146
|
+
## 9. Contributions
|
|
147
|
+
|
|
148
|
+
Contributions to RateXp are governed by the Contributor License Agreement in [CLA.md](./CLA.md).
|
|
149
|
+
|
|
150
|
+
You may propose contribution ideas privately to the Licensor. Changes may be submitted only after the Licensor agrees in writing. The Contributor License Agreement does not itself grant permission to publish source code or modifications in public pull requests, issues, or other public submissions; such publication requires the written permission described in Section 8, subject to Section 18.
|
|
151
|
+
|
|
152
|
+
## 10. Commercial Licensing
|
|
153
|
+
|
|
154
|
+
If Your intended use requires a Commercial License under Section 6, You must obtain that license from the Licensor before beginning that use. Contact: hikmet.beyoglu@hotmail.com.
|
|
155
|
+
|
|
156
|
+
Contacting the Licensor, requesting permission, or discussing terms does not grant additional rights. The separate written license agreement must be in effect before the additional use begins.
|
|
157
|
+
|
|
158
|
+
Nothing in this License obligates the Licensor to offer a Commercial License or to offer one under any particular pricing or terms.
|
|
159
|
+
|
|
160
|
+
Commercial licenses may provide broader rights than this License, including an extended trial, and may be granted free of charge or for a fee on separately agreed terms.
|
|
161
|
+
|
|
162
|
+
## 11. Ownership and Reservation of Intellectual Property
|
|
163
|
+
|
|
164
|
+
The Licensed Software is licensed, not sold.
|
|
165
|
+
|
|
166
|
+
Except for the limited rights expressly granted by this License, the Licensor and applicable contributors retain all right, title, and interest in the Licensed Software.
|
|
167
|
+
|
|
168
|
+
Except for the limited permissions expressly granted by this License, no rights are granted under the Licensor's copyrights, patents, patent applications, trade secrets, know-how, trademarks, designs, or other intellectual property, including any such rights in algorithms, methods, techniques, documentation, or architecture, to the extent those rights exist and are owned or controlled by the Licensor.
|
|
169
|
+
|
|
170
|
+
No rights are granted by implication, estoppel, or otherwise.
|
|
171
|
+
|
|
172
|
+
This reservation preserves existing rights; it does not create exclusive rights in unprotected ideas, methods, or functionality, or make publicly available information a trade secret.
|
|
173
|
+
|
|
174
|
+
## 12. Trademarks
|
|
175
|
+
|
|
176
|
+
This License does not grant permission to use the RateXp name, logos, trademarks, service marks, branding, or other identifiers except as reasonably necessary to identify the Licensed Software and comply with attribution requirements.
|
|
177
|
+
|
|
178
|
+
## 13. Termination
|
|
179
|
+
|
|
180
|
+
If You violate this License, Your rights under it terminate automatically when the violation occurs.
|
|
181
|
+
|
|
182
|
+
After You receive Your first written notice of a violation from the Licensor, Your rights are automatically reinstated once You are in full compliance and have taken practical steps to correct past violations, provided both conditions are met no later than 30 calendar days after receiving that notice. If both conditions are already met when You receive that notice, reinstatement takes effect on receipt. Your rights remain terminated until reinstatement. A later notice of a violation does not give You another automatic right to reinstatement.
|
|
183
|
+
|
|
184
|
+
Upon termination, You must cease exercising the rights granted by this License, including running the Licensed Software under it, unless and until those rights are reinstated or separately granted in writing by the Licensor.
|
|
185
|
+
|
|
186
|
+
Reinstatement does not restart or extend a Trial Period, authorize a use requiring a Commercial License, or waive any claim arising from a past violation. Access to the Hosted Service itself remains governed by its [Terms of Service](./TERMS.md).
|
|
187
|
+
|
|
188
|
+
Termination under this License does not prevent the Licensor from granting You rights under a separate Commercial License.
|
|
189
|
+
|
|
190
|
+
## 14. Disclaimer of Warranty
|
|
191
|
+
|
|
192
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE," WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY.
|
|
193
|
+
|
|
194
|
+
THE LICENSOR DISCLAIMS, TO THE EXTENT PERMITTED BY LAW, WARRANTIES INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, ACCURACY, RELIABILITY, AND FITNESS FOR PRODUCTION USE.
|
|
195
|
+
|
|
196
|
+
YOU USE THE LICENSED SOFTWARE AT YOUR OWN RISK.
|
|
197
|
+
|
|
198
|
+
## 15. Limitation of Liability
|
|
199
|
+
|
|
200
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSOR AND CONTRIBUTORS WILL NOT BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR FOR LOSS OF PROFITS, REVENUE, DATA, BUSINESS, GOODWILL, OR BUSINESS OPPORTUNITIES ARISING FROM OR RELATED TO THE LICENSED SOFTWARE OR THIS LICENSE.
|
|
201
|
+
|
|
202
|
+
WHERE LIABILITY CANNOT LEGALLY BE EXCLUDED, LIABILITY WILL BE LIMITED TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW.
|
|
203
|
+
|
|
204
|
+
## 16. Third-Party Components
|
|
205
|
+
|
|
206
|
+
Third-party software included with or used by RateXp remains subject to its respective license terms, listed in [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md).
|
|
207
|
+
|
|
208
|
+
This License does not override the license applicable to any third-party component.
|
|
209
|
+
|
|
210
|
+
## 17. Governing Law
|
|
211
|
+
|
|
212
|
+
Unless a separate written agreement with the Licensor provides otherwise, this License is governed by the laws of Austria, excluding its conflict of law rules.
|
|
213
|
+
|
|
214
|
+
To the extent legally permissible, disputes arising from this License will be subject to the jurisdiction of the competent courts in Linz, Austria.
|
|
215
|
+
|
|
216
|
+
## 18. Entire License
|
|
217
|
+
|
|
218
|
+
This License constitutes the terms governing use of the Licensed Software unless You and the Licensor enter into a separate written agreement.
|
|
219
|
+
|
|
220
|
+
A Commercial License or other written agreement between You and the Licensor may supersede this License for the uses covered by that agreement.
|
|
221
|
+
|
|
222
|
+
Nothing in this License excludes, restricts, or requires You to waive rights that applicable law does not allow to be excluded, restricted, or waived. This includes applicable mandatory copyright exceptions and consumer protections.
|
|
223
|
+
|
|
224
|
+
The time limits and restrictions in this License apply to permissions granted by this License. They do not revoke permissions independently granted by the Licensor under the terms of a source hosting platform, including rights to view and fork a public repository within that platform as permitted by its terms and functionality.
|
|
225
|
+
|
|
226
|
+
For example, if RateXp is publicly hosted on GitHub, Section 8 does not prohibit viewing or forking that repository within GitHub to the extent GitHub's terms independently permit those activities. However, creating or possessing a fork does not, by itself, grant broader rights to use, modify, deploy, redistribute, sublicense, or commercially exploit the Licensed Software beyond the scope of those platform permissions. Activities outside that scope require permission under this License, the Licensor's separate written permission, or applicable law. A fork does not restart or extend an existing Trial Period or remove restrictions that apply to activities outside the platform permissions.
|
|
227
|
+
|
|
228
|
+
## 19. Severability
|
|
229
|
+
|
|
230
|
+
If any provision of this License is held invalid or unenforceable, that provision will be excluded to the extent required by applicable law. The remaining provisions will remain in effect, provided this License can continue without the affected provision and applicable law permits. This Section does not authorize rewriting or partial enforcement of an invalid provision where applicable law prohibits it.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
RateXp Source Available License 1.0
|
|
235
|
+
|
|
236
|
+
This is a source-available license, not an open-source license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ratexp
|
ratexp.py
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""RateXp SDK: qualify your agent with human evals, asked where the run happened.
|
|
2
|
+
|
|
3
|
+
Install it with pip, or put ratexp in requirements.txt:
|
|
4
|
+
|
|
5
|
+
pip install ratexp
|
|
6
|
+
|
|
7
|
+
Or download this one file from your RateXp core, with the address of that core inside:
|
|
8
|
+
|
|
9
|
+
curl -fsSL https://ratexp-core.azurewebsites.net/sdk/python/ratexp.py -o ratexp.py
|
|
10
|
+
|
|
11
|
+
At the end of a run, your agent posts the rating question where the person is (the chat,
|
|
12
|
+
the pull request, the Jira ticket). The person answers any of the evals in their own words.
|
|
13
|
+
Then your agent sends the reply to RateXp, with the chat history:
|
|
14
|
+
|
|
15
|
+
from ratexp import RateXp
|
|
16
|
+
|
|
17
|
+
rx = RateXp(agent="acme-review-bot")
|
|
18
|
+
post_comment(rx.rating_question()) # every eval of core, or rating_question([...])
|
|
19
|
+
... # the person replies, for example "satisfied yes, store, great review"
|
|
20
|
+
rating = rx.send_reply(reply_text, session_id="pr-42", messages=messages)
|
|
21
|
+
if rating is None:
|
|
22
|
+
... # the reply answers no eval: handle the reply as usual
|
|
23
|
+
|
|
24
|
+
The SDK talks to the hosted core, or to the core in the RATEXP_URL environment variable, or
|
|
25
|
+
to the core_url you give RateXp. Python 3.9 or later, standard library only. The guide:
|
|
26
|
+
https://ratexp-core.azurewebsites.net/guide/docs/sdk/
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
from __future__ import annotations
|
|
30
|
+
|
|
31
|
+
import json
|
|
32
|
+
import os
|
|
33
|
+
import urllib.error
|
|
34
|
+
import urllib.parse
|
|
35
|
+
import urllib.request
|
|
36
|
+
import uuid
|
|
37
|
+
from dataclasses import dataclass
|
|
38
|
+
|
|
39
|
+
__version__ = "0.1.0"
|
|
40
|
+
|
|
41
|
+
# The core to talk to when neither core_url nor RATEXP_URL names one: the hosted core. A
|
|
42
|
+
# download from a core holds that core's address here instead.
|
|
43
|
+
CORE_URL = "https://ratexp-core.azurewebsites.net"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class Rating:
|
|
48
|
+
"""The ratings in a person's reply. answers maps each eval that the person answered to
|
|
49
|
+
True for its good answer (for example True) and False for its bad one; store is True
|
|
50
|
+
when the person allowed RateXp to store the run's messages; comment is the whole reply."""
|
|
51
|
+
|
|
52
|
+
answers: dict[str, bool]
|
|
53
|
+
store: bool
|
|
54
|
+
comment: str
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class RateXpError(Exception):
|
|
58
|
+
"""RateXp core did not take a request. status is core's HTTP status, or 0 when core did
|
|
59
|
+
not answer."""
|
|
60
|
+
|
|
61
|
+
def __init__(self, status: int, detail: str) -> None:
|
|
62
|
+
super().__init__(f"RateXp core answered {status}: {detail}")
|
|
63
|
+
self.status = status
|
|
64
|
+
self.detail = detail
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class RateXp:
|
|
68
|
+
"""Asks for and sends the ratings of one agent, named by `agent` on the dashboard."""
|
|
69
|
+
|
|
70
|
+
def __init__(
|
|
71
|
+
self, agent: str, core_url: str | None = None, timeout_seconds: float = 30
|
|
72
|
+
) -> None:
|
|
73
|
+
self.agent = agent
|
|
74
|
+
self.core_url = (core_url or os.environ.get("RATEXP_URL") or CORE_URL).rstrip("/")
|
|
75
|
+
self.timeout_seconds = timeout_seconds
|
|
76
|
+
|
|
77
|
+
def evals(self) -> dict:
|
|
78
|
+
"""The evals of core: {"default_eval": <name>, "evals": [{"name", "question",
|
|
79
|
+
"good_label", "good_description", "bad_label", "bad_description"}, ...]}. One HTTP
|
|
80
|
+
call."""
|
|
81
|
+
return self._call("GET", "/evals")
|
|
82
|
+
|
|
83
|
+
def rating_question(self, evals: list[str] | None = None) -> str:
|
|
84
|
+
"""The text for your agent to post: one line for each eval named in `evals`, or for
|
|
85
|
+
every eval of core, then how to share and comment. One HTTP call."""
|
|
86
|
+
query = f"?{urllib.parse.urlencode({'evals': evals}, doseq=True)}" if evals else ""
|
|
87
|
+
return self._call("GET", f"/rating-question{query}")["text"]
|
|
88
|
+
|
|
89
|
+
def send_reply(
|
|
90
|
+
self,
|
|
91
|
+
reply: str,
|
|
92
|
+
*,
|
|
93
|
+
session_id: str,
|
|
94
|
+
messages: list | None = None,
|
|
95
|
+
evals: list[str] | None = None,
|
|
96
|
+
skill_name: str | None = None,
|
|
97
|
+
) -> Rating | None:
|
|
98
|
+
"""Send the person's reply to the rating question; give the same `evals` as to
|
|
99
|
+
rating_question. core reads the reply and stores one rating for each eval answered.
|
|
100
|
+
Returns None when the reply answers no eval. When the reply says store, also sends
|
|
101
|
+
`messages`, your agent's message list, with each rating. One HTTP call, plus one for
|
|
102
|
+
each rating when the messages go along."""
|
|
103
|
+
fields = self._run_fields(session_id, skill_name)
|
|
104
|
+
body = {**fields, "request_id": str(uuid.uuid4()), "reply": reply}
|
|
105
|
+
if evals:
|
|
106
|
+
body["evals"] = list(evals)
|
|
107
|
+
answer = self._call("POST", "/reply", body)
|
|
108
|
+
if answer["rating"] is None:
|
|
109
|
+
return None
|
|
110
|
+
rating = Rating(**answer["rating"])
|
|
111
|
+
if rating.store and messages:
|
|
112
|
+
for eval_name, value in rating.answers.items():
|
|
113
|
+
rated = self._rated(eval_name, value, rating.comment)
|
|
114
|
+
# The request_id core gave this rating, so a repeat stores nothing twice.
|
|
115
|
+
rated["request_id"] = answer["request_ids"][eval_name]
|
|
116
|
+
self._call("POST", "/transcript", {**fields, **rated, "messages": messages})
|
|
117
|
+
return rating
|
|
118
|
+
|
|
119
|
+
def send_rating(
|
|
120
|
+
self,
|
|
121
|
+
answers: dict[str, bool],
|
|
122
|
+
*,
|
|
123
|
+
session_id: str,
|
|
124
|
+
comment: str | None = None,
|
|
125
|
+
store: bool = False,
|
|
126
|
+
messages: list | None = None,
|
|
127
|
+
skill_name: str | None = None,
|
|
128
|
+
) -> None:
|
|
129
|
+
"""Store the answers that your own buttons collected: `answers` maps each eval name to
|
|
130
|
+
True for its good answer and False for its bad one. One rating for each eval, with
|
|
131
|
+
the same comment. When `store` is True, also sends `messages` with each rating; set
|
|
132
|
+
it only when the person allowed it. One HTTP call per eval, two with the messages."""
|
|
133
|
+
fields = self._run_fields(session_id, skill_name)
|
|
134
|
+
for eval_name, value in answers.items():
|
|
135
|
+
# One request_id for the rating and its messages, so a repeat stores nothing twice.
|
|
136
|
+
rated = {**self._rated(eval_name, value, comment), "request_id": str(uuid.uuid4())}
|
|
137
|
+
self._call("POST", "/feedback", {**fields, **rated})
|
|
138
|
+
if store and messages:
|
|
139
|
+
self._call("POST", "/transcript", {**fields, **rated, "messages": messages})
|
|
140
|
+
|
|
141
|
+
def _run_fields(self, session_id: str, skill_name: str | None) -> dict:
|
|
142
|
+
fields = {"agent": self.agent, "session_id": session_id}
|
|
143
|
+
if skill_name:
|
|
144
|
+
fields["skill_name"] = skill_name
|
|
145
|
+
return fields
|
|
146
|
+
|
|
147
|
+
@staticmethod
|
|
148
|
+
def _rated(eval_name: str, value: bool, comment: str | None) -> dict:
|
|
149
|
+
# The messages carry the rating too: core labels them with it.
|
|
150
|
+
return {"eval_name": eval_name, "score": 1 if value else 2, "comment": comment}
|
|
151
|
+
|
|
152
|
+
def _call(self, method: str, path: str, body: dict | None = None) -> dict:
|
|
153
|
+
data = None if body is None else json.dumps(body).encode()
|
|
154
|
+
headers = {} if data is None else {"Content-Type": "application/json"}
|
|
155
|
+
request = urllib.request.Request(
|
|
156
|
+
self.core_url + path, data=data, headers=headers, method=method
|
|
157
|
+
)
|
|
158
|
+
try:
|
|
159
|
+
with urllib.request.urlopen(request, timeout=self.timeout_seconds) as response:
|
|
160
|
+
return json.loads(response.read())
|
|
161
|
+
except urllib.error.HTTPError as e:
|
|
162
|
+
raise RateXpError(e.code, e.read().decode("utf-8", "replace")) from e
|
|
163
|
+
except OSError as e: # no connection, or no answer in time
|
|
164
|
+
raise RateXpError(0, str(e)) from e
|