Skip to content

vastai_sdk Library Not Documented + Missing Query Format for search_offers() #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kaankutan opened this issue Apr 1, 2025 · 1 comment

Comments

@kaankutan
Copy link

I found that the vastai_sdk library exists but is not mentioned in the Vast.ai documentation. I tried using it, but I couldn't find any documentation on how to properly format queries for the search_offers method.

Steps to Reproduce

  1. Install the Vast.ai Python SDK:
    pip install vastai_sdk
  2. Run the following code:
    import vastai_sdk
    
    v = vastai_sdk.VastAI(api_key='')
    
    print(v.search_offers(query='...', limit=1))  # No documentation for query format
  3. There is no clear documentation on how to structure the query parameter.

Expected Behavior

The documentation should include details on vastai_sdk and the correct query format for search_offers().

Additional Context

  • The official documentation only mentions vastai, but vastai_sdk is available.
  • There is no example or explanation for the query language used in search_offers().

Could you please provide documentation or examples on how to correctly format queries for search_offers()?

Thanks! 🚀

@kristopolous
Copy link
Collaborator

>>> import vastai_sdk
>>> n=vastai_sdk.VastAI()
>>> help(n.search_offers)
Help on method search_offers in module vastai_sdk.vastai_sdk:

search_offers(query: Any = None, *, type: Any = 'on-demand', no_default: Any = False, new: Any = False, limit: int = None, disable_bundling: Any = False, storage: float = 5.0, order: str = 'score-') method of vastai_sdk.vastai_sdk.VastAI instance
    Creates a query based on search parameters as in the examples above.

    Query syntax:

        query = comparison comparison...
        comparison = field op value
        field = <name of a field>
        op = one of: <, <=, ==, !=, >=, >, in, notin
        value = <bool, int, float, string> | 'any' | [value0, value1, ...]
        bool: True, False

    note: to pass '>' and '<' on the command line, make sure to use quotes
    note: to encode a string query value (ie for gpu_name), replace any spaces ' ' with underscore '_'

    Args:
            query (Any): Query to search for. default: 'external=false rentable=true verified=true', pass -n to ignore default
            type (Any): Show 'on-demand', 'reserved', or 'bid'(interruptible) pricing. default: on-demand
                    Default is on-demand.
            no_default (Any): Disable default query
                    Default is False.
            new (Any): New search exp
                    Default is False.
            limit (int): No description
            disable_bundling (Any): Deprecated
                    Default is False.
            storage (float): Amount of storage to use for pricing, in GiB. default=5.0GiB
                    Default is 5.0.
            order (str): Comma-separated list of fields to sort on. postfix field with - to sort desc. ex: -o 'num_gpus,total_flops-'.  default='score-'
                    Default is score-.

what exactly are you looking for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants