Instructions to use apus-ailab/APUS-Reflex with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use apus-ailab/APUS-Reflex with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("apus-ailab/APUS-Reflex", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download deployment/sdk_example.py from apus-ailab/APUS-Reflex: direct link, hf CLI and curl.
- Browser
- Download file 2.34 kB
-
https://huggingface.co/apus-ailab/APUS-Reflex/resolve/main/deployment/sdk_example.py
- Command line
-
hf download hf://apus-ailab/APUS-Reflex/deployment/sdk_example.py
-
curl -L -o sdk_example.py https://huggingface.co/apus-ailab/APUS-Reflex/resolve/main/deployment/sdk_example.py
2.34 kB
| """English customer-support examples using the official TypeSafe Python SDK.""" | |
| import argparse | |
| import os | |
| from typesafe_sdk import Choice, Noul, RetryPolicy, Score, TypeSafeClient | |
| def main(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--base-url", default="http://127.0.0.1:30013") | |
| parser.add_argument("--model", default="APUS-OpenJev-v1-9B") | |
| parser.add_argument("--effort", choices=["low", "high"], default="high") | |
| args = parser.parse_args() | |
| with TypeSafeClient( | |
| base_url=args.base_url, | |
| api_key=os.environ["JEV_API_KEY"], | |
| model=args.model, | |
| retry=RetryPolicy(max_retries=0), | |
| ) as client: | |
| print(client.models.list().model_dump_json(indent=2)) | |
| result = client.system_one( | |
| state={ | |
| "customer_message": "My order arrived damaged yesterday. I would like a refund.", | |
| "policy": "A damaged item reported within 30 days is eligible for a refund.", | |
| }, | |
| questions={ | |
| "support_queue": Choice( | |
| instructions="Choose the team that should handle this ticket.", | |
| criteria={ | |
| "returns": "Damaged items, returns, and refunds", | |
| "billing": "Invoice or payment issues", | |
| "shipping": "Tracking and delivery updates", | |
| }, | |
| ), | |
| "refund_eligible": Noul( | |
| instructions="Does the stated policy make this customer eligible for a refund?" | |
| ), | |
| "urgency": Score( | |
| instructions="Rate the urgency of this support ticket.", | |
| criteria=[ | |
| "Routine question", | |
| "Customer needs timely assistance", | |
| "Immediate safety or security risk", | |
| ], | |
| ), | |
| }, | |
| extra_body={"effort": args.effort}, | |
| ) | |
| print(result.model_dump_json(indent=2)) | |
| print("Effort:", result.raw_http_response.headers.get("x-openjev-effort")) | |
| print( | |
| "Configured execution layers:", | |
| result.raw_http_response.headers.get("x-openjev-executed-layers"), | |
| ) | |
| if __name__ == "__main__": | |
| main() | |