Upload files to "/"
Signed-off-by: birdup <gecko@birdup.link>
This commit is contained in:
parent
80090ecd1b
commit
21c4145f54
|
|
@ -0,0 +1,39 @@
|
||||||
|
# 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
|
||||||
|
|
||||||
|
1. Python 3.x installed on your system.
|
||||||
|
2. The `requests` library installed. You can install it using `pip install requests`.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
1. 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.
|
||||||
|
|
||||||
|
2. Customize the `content` variable with the prompt you want to send to the model.
|
||||||
|
|
||||||
|
3. Run the script, and it will print the response from the model.
|
||||||
|
|
||||||
|
## Explanation
|
||||||
|
|
||||||
|
The script performs the following steps:
|
||||||
|
|
||||||
|
1. Imports the necessary libraries: `requests` and `uuid`.
|
||||||
|
2. Defines the variables needed for the API requests.
|
||||||
|
3. Creates a function `generate_unique_id()` to generate a unique ID for each request.
|
||||||
|
4. Sends the first request to the `/api/v1/workspaces/0/apps/{app_id}/app-conversation-messages` endpoint with the provided data and headers. This request generates a response from the Claude 3 Sonnet Example model.
|
||||||
|
5. Sends the second request to the `/api/v1/user/credit?locale=en-US` endpoint 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.
|
||||||
Loading…
Reference in New Issue