Skip to content

Commit 854f7b2

Browse files
committed
init oci-openai
1 parent e377bc6 commit 854f7b2

File tree

14 files changed

+965
-25
lines changed

14 files changed

+965
-25
lines changed

.gitignore

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[codz]
4+
*$py.class
5+
6+
7+
# Distribution / packaging
8+
.Python
9+
build/
10+
develop-eggs/
11+
dist/
12+
downloads/
13+
eggs/
14+
.eggs/
15+
lib/
16+
lib64/
17+
parts/
18+
sdist/
19+
var/
20+
wheels/
21+
share/python-wheels/
22+
*.egg-info/
23+
.installed.cfg
24+
*.egg
25+
MANIFEST
26+
27+
28+
# Unit test / coverage reports
29+
htmlcov/
30+
.tox/
31+
.nox/
32+
.coverage
33+
.coverage.*
34+
.cache
35+
nosetests.xml
36+
coverage.xml
37+
*.cover
38+
*.py.cover
39+
.hypothesis/
40+
.pytest_cache/
41+
cover/
42+
43+
# Environments
44+
.env
45+
.envrc
46+
.venv
47+
env/
48+
venv/
49+
ENV/
50+
env.bak/
51+
venv.bak/
52+
53+
# mkdocs documentation
54+
/site
55+
56+
# mypy
57+
.mypy_cache/
58+
.dmypy.json
59+
dmypy.json
60+
61+
# Pyre type checker
62+
.pyre/
63+
64+
# pytype static type analyzer
65+
.pytype/
66+
67+
# Cython debug symbols
68+
cython_debug/
69+
70+
# PyCharm
71+
.idea/
72+
73+
# Visual Studio Code
74+
.vscode/
75+
76+
# Ruff stuff:
77+
.ruff_cache/
78+
79+
# PyPI configuration file
80+
.pypirc

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
*Detailed instructions on how to contribute to the project, if applicable. Must include section about Oracle Contributor Agreement with link and instructions*
2-
31
# Contributing to this repository
42

53
We welcome your contributions! There are multiple ways to contribute.

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2023 Oracle and/or its affiliates.
1+
Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
22

33
The Universal Permissive License (UPL), Version 1.0
44

Makefile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Define the directory containing the source code
2+
SRC_DIR := ./src
3+
TEST_DIR := ./tests
4+
5+
6+
.PHONY: all
7+
all: test lint build
8+
9+
##@ General
10+
11+
.PHONY: help
12+
help: ## Display this help.
13+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
14+
15+
##@ Development
16+
17+
.PHONY: install
18+
install: ## Install project dependencies.
19+
uv pip install --editable .
20+
21+
.PHONY: dev
22+
dev: ## Install development dependencies.
23+
uv pip install ".[dev]"
24+
25+
.PHONY: test
26+
test: ## Run tests.
27+
uv run --no-reinstall pytest $(TEST_DIR) --cov --cov-config=.coveragerc -vv -s
28+
29+
.PHONY: clean
30+
clean: ## Remove build artifacts.
31+
rm -rf build dist *.egg-info .pytest_cache .coverage
32+
33+
.PHONY: format
34+
format: ## Format code using ruff.
35+
uv run --no-reinstall isort $(SRC_DIR) $(TEST_DIR)
36+
uv run --no-reinstall ruff format $(SRC_DIR) $(TEST_DIR); uv run --no-reinstall ruff check --fix $(SRC_DIR) $(TEST_DIR)
37+
38+
.PHONY: lint
39+
lint: ## Run linters using ruff.
40+
uv run --no-reinstall ruff format --diff $(SRC_DIR) $(TEST_DIR)
41+
uv run --no-reinstall mypy $(SRC_DIR)
42+
43+
.PHONY: check
44+
check: format lint ## Run format and lint.
45+
46+
##@ Build
47+
48+
.PHONY: build
49+
build: ## Build the application.
50+
uv build

README.md

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,50 @@
1-
*This repository acts as a template for all of Oracle’s GitHub repositories. It contains information about the guidelines for those repositories. All files and sections contained in this template are mandatory, and a GitHub app ensures alignment with these guidelines. To get started with a new repository, replace the italic paragraphs with the respective text for your project.*
1+
# oci-openai
22

3-
# Project name
3+
[![PyPI - Version](https://img.shields.io/pypi/v/oci-openai.svg)](https://pypi.org/project/oci-openai)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/oci-openai.svg)](https://pypi.org/project/oci-openai)
45

5-
*Describe your project's features, functionality and target audience*
6+
OCI-OpenAI is a client library maintained by the Oracle Cloud Infrastructure (OCI) [Generative AI Service](https://docs.oracle.com/en-us/iaas/Content/generative-ai/home.htm) team.
7+
This package simplifies integration between OpenAI’s Python SDK and Oracle Cloud Infrastructure (OCI) GenAI service by providing robust authentication and authorization utilities.
8+
Developers can seamlessly connect to Oracle Generative AI services using OCI credentials, ensuring secure and compliant access while leveraging industry best practices.
69

7-
## Installation
8-
9-
*Provide detailed step-by-step installation instructions. You can name this section **How to Run** or **Getting Started** instead of **Installation** if that's more acceptable for your project*
10+
-----
1011

11-
## Documentation
12+
## Table of Contents
1213

13-
*Developer-oriented documentation can be published on GitHub, but all product documentation must be published on <https://docs.oracle.com>*
14+
- [Installation](#installation)
15+
- [License](#license)
1416

15-
## Examples
17+
## Installation
1618

17-
*Describe any included examples or provide a link to a demo/tutorial*
19+
```console
20+
pip install oci-openai
21+
```
1822

19-
## Help
23+
## Examples
2024

21-
*Inform users on where to get help or how to receive official support from Oracle (if applicable)*
25+
```python
26+
from oci_openai import OciOpenAI, OciSessionAuth
27+
28+
client = OciOpenAI(
29+
service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
30+
auth=OciSessionAuth(profile_name="<profile name>"),
31+
compartment_id="<compartment ocid>",
32+
)
33+
34+
completion = client.chat.completions.create(
35+
model="<model name>",
36+
messages=[
37+
{
38+
"role": "user",
39+
"content": "How do I output all files in a directory using Python?",
40+
},
41+
],
42+
)
43+
print(completion.model_dump_json())
44+
```
2245

2346
## Contributing
2447

25-
*If your project has specific contribution requirements, update the CONTRIBUTING.md file to ensure those requirements are clearly explained*
26-
2748
This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)
2849

2950
## Security
@@ -32,13 +53,7 @@ Please consult the [security guide](./SECURITY.md) for our responsible security
3253

3354
## License
3455

35-
*The correct copyright notice format for both documentation and software is*
36-
"Copyright (c) [year,] year Oracle and/or its affiliates."
37-
*You must include the year the content was first released (on any platform) and the most recent year in which it was revised*
38-
39-
Copyright (c) 2023 Oracle and/or its affiliates.
40-
41-
*Replace this statement if your project is not licensed under the UPL*
56+
Copyright (c) 2025 Oracle and/or its affiliates.
4257

4358
Released under the Universal Permissive License v1.0 as shown at
44-
<https://oss.oracle.com/licenses/upl/>.
59+
<https://oss.oracle.com/licenses/upl/>

0 commit comments

Comments
 (0)