|
|
||
|---|---|---|
| README.MD | ||
| anakin.py | ||
README.MD
Reverse Engineer: Interacting with the Anakin API
This Python script demonstrates how to interact with the Anakin API to generate a response from the Claude 3 Sonnet Example model.
Prerequisites
- Python 3.x installed on your system.
- The
requestslibrary installed. You can install it usingpip install requests.
Usage
-
Replace the following variables with your own values:
workspace_id: Your user workspace ID.app_id: The ID of the app you want to use.app_instance_id: The ID of the app instance you want to use.app_conversation_id: The ID of the app conversation you want to use.authorization_bearer: Your authorization bearer token.
-
Customize the
contentvariable with the prompt you want to send to the model. -
Run the script, and it will print the response from the model.
Explanation
The script performs the following steps:
- Imports the necessary libraries:
requestsanduuid. - Defines the variables needed for the API requests.
- Creates a function
generate_unique_id()to generate a unique ID for each request. - Sends the first request to the
/api/v1/workspaces/0/apps/{app_id}/app-conversation-messagesendpoint with the provided data and headers. This request generates a response from the Claude 3 Sonnet Example model. - Sends the second request to the
/api/v1/user/credit?locale=en-USendpoint to retrieve the user's credit information.
The script uses the requests library to make the API calls and handles any ChunkedEncodingError exceptions that may occur during the streaming response.
Notes
- Make sure to replace the placeholders with your actual values before running the script.
- The script assumes that you have the necessary permissions and access to the Anakin API.
- The script is provided as an example and may need to be modified to fit your specific use case.