|
| 1 | +--- |
| 2 | +orphan: true |
| 3 | +--- |
| 4 | +<!-- This file was auto-generated by distro_codegen.py, please edit source --> |
| 5 | +# OCI Distribution |
| 6 | + |
| 7 | +The `llamastack/distribution-oci` distribution consists of the following provider configurations. |
| 8 | + |
| 9 | +| API | Provider(s) | |
| 10 | +|-----|-------------| |
| 11 | +| agents | `inline::meta-reference` | |
| 12 | +| datasetio | `remote::huggingface`, `inline::localfs` | |
| 13 | +| eval | `inline::meta-reference` | |
| 14 | +| files | `inline::localfs` | |
| 15 | +| inference | `remote::oci` | |
| 16 | +| safety | `inline::llama-guard` | |
| 17 | +| scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | |
| 18 | +| telemetry | `inline::meta-reference` | |
| 19 | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime`, `remote::model-context-protocol` | |
| 20 | +| vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | |
| 21 | + |
| 22 | + |
| 23 | +### Environment Variables |
| 24 | + |
| 25 | +The following environment variables can be configured: |
| 26 | + |
| 27 | +- `OCI_AUTH_TYPE`: OCI authentication type (instance_principal or config_file) (default: `instance_principal`) |
| 28 | +- `OCI_USER_OCID`: OCI user OCID for authentication (default: ``) |
| 29 | +- `OCI_TENANCY_OCID`: OCI tenancy OCID for authentication (default: ``) |
| 30 | +- `OCI_FINGERPRINT`: OCI API key fingerprint for authentication (default: ``) |
| 31 | +- `OCI_PRIVATE_KEY`: OCI private key for authentication (default: ``) |
| 32 | +- `OCI_REGION`: OCI region (e.g., us-ashburn-1, us-chicago-1, us-phoenix-1, eu-frankfurt-1) (default: ``) |
| 33 | +- `OCI_COMPARTMENT_OCID`: OCI compartment ID for the Generative AI service (default: ``) |
| 34 | +- `OCI_CONFIG_FILE_PATH`: OCI config file path (required if OCI_AUTH_TYPE is config_file) (default: `~/.oci/config`) |
| 35 | +- `OCI_CLI_PROFILE`: OCI CLI profile name to use from config file (default: `DEFAULT`) |
| 36 | + |
| 37 | + |
| 38 | +## Prerequisites |
| 39 | +### Oracle Cloud Infrastructure Setup |
| 40 | + |
| 41 | +Before using the OCI Generative AI distribution, ensure you have: |
| 42 | + |
| 43 | +1. **Oracle Cloud Infrastructure Account**: Sign up at [Oracle Cloud Infrastructure](https://cloud.oracle.com/) |
| 44 | +2. **Generative AI Service Access**: Enable the Generative AI service in your OCI tenancy |
| 45 | +3. **Compartment**: Create or identify a compartment where you'll deploy Generative AI models |
| 46 | +4. **Authentication**: Configure authentication using either: |
| 47 | + - **Instance Principal** (recommended for cloud-hosted deployments) |
| 48 | + - **API Key** (for on-premises or development environments) |
| 49 | + |
| 50 | +### Authentication Methods |
| 51 | + |
| 52 | +#### Instance Principal Authentication (Recommended) |
| 53 | +Instance Principal authentication allows OCI resources to authenticate using the identity of the compute instance they're running on. This is the most secure method for production deployments. |
| 54 | + |
| 55 | +Requirements: |
| 56 | +- Instance must be running in an Oracle Cloud Infrastructure compartment |
| 57 | +- Instance must have appropriate IAM policies to access Generative AI services |
| 58 | + |
| 59 | +#### API Key Authentication |
| 60 | +For development or on-premises deployments, you can use API key authentication with the following information: |
| 61 | +- User OCID |
| 62 | +- Tenancy OCID |
| 63 | +- API key fingerprint |
| 64 | +- Private key |
| 65 | +- Region |
| 66 | + |
| 67 | +### Required IAM Policies |
| 68 | + |
| 69 | +Ensure your OCI user or instance has the following policy statements: |
| 70 | + |
| 71 | +``` |
| 72 | +Allow group <group_name> to use generative-ai-inference-endpoints in compartment <compartment_name> |
| 73 | +Allow group <group_name> to manage generative-ai-inference-endpoints in compartment <compartment_name> |
| 74 | +``` |
| 75 | + |
| 76 | +## Supported Services |
| 77 | + |
| 78 | +### Inference: OCI Generative AI |
| 79 | +Oracle Cloud Infrastructure Generative AI provides access to high-performance AI models through OCI's Platform-as-a-Service offering. The service supports: |
| 80 | + |
| 81 | +- **Chat Completions**: Conversational AI with context awareness |
| 82 | +- **Text Generation**: Complete prompts and generate text content |
| 83 | +- **Embeddings**: Convert text to vector embeddings for search and retrieval |
| 84 | +- **Multiple Model Support**: Access to various foundation models including Cohere, Meta, and custom models |
| 85 | + |
| 86 | +#### Available Models |
| 87 | +Common OCI Generative AI models include access to Meta, Cohere, OpenAI, and Grok models. |
| 88 | + |
| 89 | +### Safety: Llama Guard |
| 90 | +For content safety and moderation, this distribution uses Meta's LlamaGuard model through the OCI Generative AI service to provide: |
| 91 | +- Content filtering and moderation |
| 92 | +- Policy compliance checking |
| 93 | +- Harmful content detection |
| 94 | + |
| 95 | +### Vector Storage: Multiple Options |
| 96 | +The distribution supports several vector storage providers: |
| 97 | +- **FAISS**: Local in-memory vector search |
| 98 | +- **ChromaDB**: Distributed vector database |
| 99 | +- **PGVector**: PostgreSQL with vector extensions |
| 100 | + |
| 101 | +### Additional Services |
| 102 | +- **Dataset I/O**: Local filesystem and Hugging Face integration |
| 103 | +- **Tool Runtime**: Web search (Brave, Tavily) and RAG capabilities |
| 104 | +- **Evaluation**: Meta reference evaluation framework |
| 105 | + |
| 106 | +## Running Llama Stack with OCI |
| 107 | + |
| 108 | +You can run the OCI distribution via Docker or local virtual environment. |
| 109 | + |
| 110 | +### Via Docker |
| 111 | + |
| 112 | +This method allows you to get started quickly without building the distribution code. |
| 113 | + |
| 114 | +```bash |
| 115 | +LLAMA_STACK_PORT=8321 |
| 116 | +docker run \ |
| 117 | + -it \ |
| 118 | + --pull always \ |
| 119 | + -p $LLAMA_STACK_PORT:$LLAMA_STACK_PORT \ |
| 120 | + -v ./run.yaml:/root/my-run.yaml \ |
| 121 | + llamastack/distribution-oci \ |
| 122 | + --config /root/my-run.yaml \ |
| 123 | + --port $LLAMA_STACK_PORT \ |
| 124 | + --env OCI_AUTH_TYPE=$OCI_AUTH_TYPE \ |
| 125 | + --env OCI_REGION=$OCI_REGION \ |
| 126 | + --env OCI_COMPARTMENT_OCID=$OCI_COMPARTMENT_OCID |
| 127 | +``` |
| 128 | + |
| 129 | +### Via venv |
| 130 | + |
| 131 | +If you've set up your local development environment, you can also build the image using your local virtual environment. |
| 132 | + |
| 133 | +```bash |
| 134 | +OCI_GENAI_MODEL_OCID=oci.ocid1.generativeaimodel.oc1.us-chicago-1.<ocid> |
| 135 | +llama stack build --distro oci --image-type venv |
| 136 | +llama stack run ./run.yaml \ |
| 137 | + --port 8321 \ |
| 138 | + --env OCI_AUTH_TYPE=$OCI_AUTH_TYPE \ |
| 139 | + --env OCI_REGION=$OCI_REGION \ |
| 140 | + --env OCI_COMPARTMENT_OCID=$OCI_COMPARTMENT_OCID |
| 141 | +``` |
| 142 | + |
| 143 | +### Configuration Examples |
| 144 | + |
| 145 | +#### Using Instance Principal (Recommended for Production) |
| 146 | +```bash |
| 147 | +export OCI_AUTH_TYPE=instance_principal |
| 148 | +export OCI_REGION=us-chicago-1 |
| 149 | +export OCI_COMPARTMENT_OCID=ocid1.compartment.oc1..<your-compartment-id> |
| 150 | +``` |
| 151 | + |
| 152 | +#### Using API Key Authentication (Development) |
| 153 | +```bash |
| 154 | +export OCI_AUTH_TYPE=config_file |
| 155 | +export OCI_CONFIG_FILE_PATH=~/.oci/config |
| 156 | +export OCI_CLI_PROFILE=DEFAULT |
| 157 | +export OCI_REGION=us-chicago-1 |
| 158 | +export OCI_COMPARTMENT_OCID=ocid1.compartment.oc1..your-compartment-id |
| 159 | +``` |
| 160 | + |
| 161 | +## Regional Endpoints |
| 162 | + |
| 163 | +OCI Generative AI is available in multiple regions. The service automatically routes to the appropriate regional endpoint based on your configuration. For a full list of regional model availability, visit: |
| 164 | + |
| 165 | +https://docs.oracle.com/en-us/iaas/Content/generative-ai/overview.htm#regions |
| 166 | + |
| 167 | +## Troubleshooting |
| 168 | + |
| 169 | +### Common Issues |
| 170 | + |
| 171 | +1. **Authentication Errors**: Verify your OCI credentials and IAM policies |
| 172 | +2. **Model Not Found**: Ensure the model OCID is correct and the model is available in your region |
| 173 | +3. **Permission Denied**: Check compartment permissions and Generative AI service access |
| 174 | +4. **Region Unavailable**: Verify the specified region supports Generative AI services |
| 175 | + |
| 176 | +### Getting Help |
| 177 | + |
| 178 | +For additional support: |
| 179 | +- [OCI Generative AI Documentation](https://docs.oracle.com/en-us/iaas/Content/generative-ai/home.htm) |
| 180 | +- [Llama Stack Issues](https://github.com/meta-llama/llama-stack/issues) |
0 commit comments