Skip to main content

LlamaIndex Llms Integration: Mymagic

Installation

To install the required package, run:

%pip install llama-index-llms-mymagic
!pip install llama-index

Setup

Before you begin, set up your cloud storage bucket and grant MyMagic API secure access. For detailed instructions, visit the MyMagic documentation.

Initialize MyMagicAI

Create an instance of MyMagicAI by providing your API key and storage configuration:

from llama_index.llms.mymagic import MyMagicAI

llm = MyMagicAI(
    api_key="your-api-key",
    storage_provider="s3",  # Options: 's3' or 'gcs'
    bucket_name="your-bucket-name",
    session="your-session-name",  # Directory for batch inference
    role_arn="your-role-arn",
    system_prompt="your-system-prompt",
    region="your-bucket-region",
    return_output=False,  # Set to True to return output JSON
    input_json_file=None,  # Input file stored on the bucket
    list_inputs=None,  # List of inputs for small batch
    structured_output=None,  # JSON schema of the output
)

Note: If return_output is set to True, max_tokens should be at least 100.

Generate Completions

To generate a text completion for a question, use the complete method:

resp = llm.complete(
    question="your-question",
    model="choose-model",  # Supported models: mistral7b, llama7b, mixtral8x7b, codellama70b, llama70b, etc.
    max_tokens=5,  # Number of tokens to generate (default is 10)
)
print(
    resp
)  # The response indicates if the final output is stored in your bucket or raises an exception if the job failed

Asynchronous Requests

For asynchronous operations, use the acomplete endpoint:

import asyncio


async def main():
    response = await llm.acomplete(
        question="your-question",
        model="choose-model",  # Supported models listed in the documentation
        max_tokens=5,  # Number of tokens to generate (default is 10)
    )
    print("Async completion response:", response)


await main()

LLM Implementation example

https://docs.llamaindex.ai/en/stable/examples/llm/mymagic/

Metadata

Release files for llama-index-llms-mymagic 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-mymagic 0.6.0
File Size Uploaded Provenance Actions
llama_index_llms_mymagic-0.6.0.tar.gz 5.9 kB Without provenance Details for llama_index_llms_mymagic-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-mymagic 0.6.0
File Interpreter ABI Platform Actions
llama_index_llms_mymagic-0.6.0-py3-none-any.whl Python 3 none any Details for llama_index_llms_mymagic-0.6.0-py3-none-any.whl

Total release size: 11.6 kB

Release files / llama_index_llms_mymagic-0.6.0.tar.gz

Download URL llama_index_llms_mymagic-0.6.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a6aa48ebeaa0ee81946473701c5aa849a9dd2b41ed9183b2f620f650df6842cf
BLAKE2b-256 checksum
How to use checksums
f27be939844333bd44e2a92ffc5ce424795885fbced84582111659eb23ccc0af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_llms_mymagic-0.6.0-py3-none-any.whl

Download URL llama_index_llms_mymagic-0.6.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c810a68a5448c715a7cd5def01adfa4d35b035e43fc0c89f0dbb370e1022ff9
BLAKE2b-256 checksum
How to use checksums
3a3438e805bd23ec04c7f3ba4707dbf9b3e21747cb56039e5982154779ff899a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-llms-mymagic 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page