Skip to main content

Python SDK for the 2ndOpinion API

Project description

secondopinion

Python SDK for the 2ndOpinion API — AI-to-AI code review.

Installation

pip install secondopinion-sdk

Quick Start

from secondopinion import SecondOpinion

client = SecondOpinion(api_key="sk_2op_...")

# Get a code review
result = client.opinion(diff="your git diff here", llm="codex")
print(result["analysis"]["summary"])

# Ask a question
answer = client.ask(question="Is this SQL query safe?", code="SELECT * FROM users WHERE id = " + user_id)
print(answer["response"])

# Check usage
status = client.status()
print(f"Credits: {status['totalAvailable']}")

Available Methods

Method Description Credits
opinion(diff, llm, context) Single-model code review 1
ask(question, llm, code, context) Ask an AI model a question 1
review(diff, llm, context) Code review (alias for opinion) 1
explain(diff, audience) Explain changes 1
consensus(diff, context) 3-model consensus review 3
bug_hunt(diff, context) 3-model bug detection 3
security_audit(diff, context) OWASP security scan 1-3
generate_tests(diff, llm, framework) Generate tests 1
status() Check account credits 0

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

secondopinion_sdk-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

secondopinion_sdk-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file secondopinion_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: secondopinion_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for secondopinion_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dfcec1c4fc1c9fd42c709d0f1685d97a39ed3bf6b962a972997f0ca4983c0deb
MD5 159c4954635894f06ee365b97786470c
BLAKE2b-256 450ce289a0401886ad3b1b00705cf55776ebbb3a16a4e55f6fb7e22599d28e72

See more details on using hashes here.

File details

Details for the file secondopinion_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for secondopinion_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 596c09721f0f198259381559db402267d3875bc81570acb8116114dc7309f80e
MD5 e951e8e713c241d47847efe212282c8c
BLAKE2b-256 572b0d6b8d1709beb4e0e16796666bf7aff1783b6f1e43698dbde31d41e44657

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page