### BioLM Python SDK - Error Handling Source: https://context7.com/context7/api_biolm_ai/llms.txt Provides an example of robust error handling in Python when using the BioLM SDK. It demonstrates how to catch specific exceptions like AuthenticationError and ValidationError, as well as general exceptions, during API calls. ```python from biolmai import BioLMClient from biolmai.exceptions import AuthenticationError, ValidationError client = BioLMClient(api_key="YOUR_API_TOKEN") try: response = client.ablang2.predict( items=[{"heavy": "INVALID", "light": "SEQ"}] ) except AuthenticationError as e: print(f"Authentication failed: {e}") except ValidationError as e: print(f"Invalid input: {e}") except Exception as e: print(f"Unexpected error: {e}") ``` -------------------------------- ### BioLM API - AlphaFold2 Structure Prediction Request Source: https://context7.com/context7/api_biolm_ai/llms.txt Demonstrates a cURL request to the BioLM API's AlphaFold2 endpoint for protein structure prediction. The example includes setting 'return_pdb' to true in the 'params' for PDB output. ```bash # AlphaFold2 structure prediction example (URL pattern inference) curl --location 'https://biolm.ai/api/v3/alphafold2/predict/' \ --header 'Authorization: Token YOUR_API_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "items": [ {"sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSGAEKAVQVK"} ], "params": { "return_pdb": true } }' ``` -------------------------------- ### Python Batch Processing for Antibody Sequences Source: https://context7.com/context7/api_biolm_ai/llms.txt This Python snippet illustrates how to use the BioLM SDK to process a batch of antibody sequences. It shows initializing the client, preparing a list of sequence pairs, and sending them in a single request to the API. The example also highlights that the results returned by the API maintain the same order as the input sequences. ```python # Python batch processing from biolmai import BioLMClient client = BioLMClient(api_key="YOUR_API_TOKEN") sequences = [ {"heavy": f"SEQ{i}_HEAVY", "light": f"SEQ{i}_LIGHT"} for i in range(100) ] # Process all 100 in one request response = client.ablang2.encode( items=sequences, params={"include": "seqcoding", "align": False} ) # Results match input order for idx, result in enumerate(response.results): print(f"Sequence {idx}: embedding dim {len(result.seqcoding)}") ``` -------------------------------- ### Python SDK: Predict Antibody Quality Source: https://context7.com/context7/api_biolm_ai/llms.txt This Python code demonstrates how to use the BioLM SDK to predict the quality of antibody sequences. It shows the process of initializing the client, defining antibody sequences, and calling the `predict` method with relevant parameters. The example also illustrates how to process the returned likelihood values to calculate an average quality score. ```python # Python SDK installation and basic usage # pip install biolm-sdk from biolmai import BioLMClient import numpy as np # Initialize client client = BioLMClient(api_key="YOUR_API_TOKEN") # Example 1: Predict antibody sequence quality antibodies = [ {"heavy": "QVQLVQSGAEVKKPGASVKVSCK", "light": "DIQMTQSPASLSASVGDRVTITC"}, {"heavy": "EVQLVESGGGLVKPGGSLKLSCA", "light": "KVVMTQSPDSLSASLGDRVTITC"} ] response = client.ablang2.predict( items=antibodies, params={"include": "likelihood"} ) for idx, result in enumerate(response.results): avg_likelihood = np.mean([np.mean(pos) for pos in result.likelihood]) print(f"Antibody {idx} average likelihood: {avg_likelihood:.3f}") ``` -------------------------------- ### BioLM API - ESMFold Structure Prediction Request Source: https://context7.com/context7/api_biolm_ai/llms.txt Shows a cURL request to the BioLM API's ESMFold endpoint for protein structure prediction. The example specifies the model endpoint and provides a protein sequence in the 'items' array. ```bash # ESMFold structure prediction example (URL pattern inference) curl --location 'https://biolm.ai/api/v3/esmfold/predict/' \ --header 'Authorization: Token YOUR_API_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "items": [ {"sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSGAEKAVQVK"} ] }' ``` -------------------------------- ### AbLang-2 Predict API Response (JSON) Source: https://api.biolm.ai/index This is an example of a successful JSON response from the AbLang-2 Predict API. The 'results' array contains prediction data, with 'likelihood' providing a list of numerical scores for each input item. The structure is consistent for all successful predictions. ```json { "results": [ { "likelihood": [ [ -4.1002655029296875, -3.792412519454956, -6.290246963500977, -10.52538013458252, -4.281508445739746, -2.5941946506500244, 1.6453051567077637, -1.645755410194397, -2.661353826522827, 0.6317749619483948, -5.689943790435791, -2.4939863681793213, -2.4904725551605225, -1.9380593299865723, -3.525383234024048, -5.7011847496032715, -4.64267110824585, -5.0373640060424805, -3.7953338623046875, -4.552462577819824 ], [ -4.9303059577941895, -2.364351749420166, 0.473676860332489, -7.698940753936768, -2.952904224395752, 1.6395647525787354, -0.6673230528831482, -4.099361419677734, -2.639918088912964, 5.9823222160339355, -4.148397445678711, -1.1819096803665161, -1.6967995166778564, -3.157752275466919, -4.484950542449951, -7.661600589752197, -4.929783344268799, -3.1536476612091064, -2.76619815826416, -3.263462543487549 ], [ -1.3144018650054932, -4.568129062652588, -3.819251537322998, -1.9378619194030762, -4.1965250968933105, -2.687631130218506, -2.723362922668457, -4.784548759460449, -5.086096286773682, -0.3037092685699463, -4.566086292266846, 0.02022393047809601, 1.1323695182800293, -1.9628984928131104, 4.916013240814209, -2.241288661956787, -0.4649328589439392, -2.990931272506714, -3.5127511024475098, -1.2442224025726318 ], [ -4.379648685455322, -3.692573308944702, -2.1171836853027344, -2.8863861560821533, -3.9857568740844727, -3.879694938659668, -0.5660212635993958, -3.4378347396850586, -5.792120456695557, 4.367126941680908, -3.921382427215576, -4.447024822235107, 0.10386629402637482, -4.409208297729492, -1.907373070716858, -6.2281174659729, -3.0315284729003906, -2.5768516063690186, -4.530858039855957, 1.0125174522399902 ], [ -2.8734171390533447, -1.3835514783859253, -5.113452434539795, -7.488833427429199, -6.019524574279785, -5.264987945556641, -3.0773420333862305, -5.346127033233643, -8.183552742004395, -1.5678106546401978, -6.141382694244385, -4.759942531585693, -1.950993537902832, -4.800195693969727, 1.185726523399353, -3.7237720489501953, -4.043385982513428, -6.340647220611572, -2.4820451736450195, 4.969179153442383 ], [ -4.2331013679504395, -1.1000510454177856, -2.595752000808716, -3.51220440864563, -3.845963478088379, -2.6056089401245117, -2.192934513092041, -0.567809522151947, -3.431880235671997, 0.46491310000419617, -3.8073325157165527, -0.625041127204895, -2.8892524242401123, -3.016024112701416, 3.891981840133667, -1.0275816917419434, -3.8430354595184326, -1.2247073650360107, 3.0996253490448, 0.029584266245365143 ], [ -4.894049644470215, -0.43913838267326355, ``` -------------------------------- ### BioLM API - Handling Malformed Request Error Source: https://context7.com/context7/api_biolm_ai/llms.txt Demonstrates how to trigger and interpret a 'Malformed request' error (400 Bad Request) when sending incorrectly formatted data to the BioLM API via cURL. The example shows a request with 'items' as a string instead of an array and the resulting error response. ```bash # Malformed request error curl --location 'https://biolm.ai/api/v3/ablang2/predict/' \ --header 'Authorization: Token YOUR_API_TOKEN' \ --header 'Content-Type: application/json' \ --data '{"items": "not_an_array"}' # Response (400 Bad Request): # { # "error": "Invalid request format: items must be an array", # "status": 400 # } ``` -------------------------------- ### AbLang-2 Encode API Response Example Source: https://api.biolm.ai/index This JSON object represents a successful response from the BioLM API's AbLang-2 Encode endpoint. It contains a list of results, where each result includes a 'seqcoding' array. This array holds the numerical encoding vectors for the input antibody sequences. ```json { "results": [ { "seqcoding": [ -0.21477425201138592, -0.12190765886129264, -0.09134528583244365, -0.06957388422725831, 0.14344040571492822, -0.09935472785111736, -0.024803472299347904, 0.12550954381603172, 0.5652195146197782, -0.07269028746796881, -0.5603958105339724, 0.2655291856978746, 0.061332246076370424, -0.020927795065183413, 0.11753569592666976, -0.478567335234188, -0.2337437029927969, 0.22826545093865955, -0.18331537908627926, 0.014750123708782828, 0.23386428023085876, 0.4283437445650206, 0.1175428234752925, -0.270794283160392, 0.3531833566889605, 0.16019647587638566, 0.19679702577345512, 0.23932347057972733, -0.030226411640315372, 0.1363206273424165, 0.16488750413169756, 0.11001235815039014, 0.40694543982253356, 0.23016244301791577, 0.15439374591497815, 0.21641580646802835, 0.38127956961226817, -0.07862312315367437, -0.5215151323115125, 0.10260881571551128, 0.008561355198788293, -0.17649716609979377, 0.2839531703468631, 0.1540467819363317, 0.008414128220037502, 0.2541606691392029, 0.48299452289938927, -0.2808258305577671, 0.2400932685803341, -0.30360164528931766, -0.028820394832805237, -0.3595662694424391, 0.03985305515337078, -0.3426932572003673, 0.027376610511804327, -0.08586848193012617, 0.05443319250993869, -0.17498197444878957, -0.2558792791164973, -0.41844808063743744, 0.23993705799255302, -0.30552569163196225, -0.4046393466346404, -0.037353658569319284, 0.12369257327415706, -0.13170756891315036, -0.21273406474467585, -0.13868948137250675, 0.21116546166184194, -0.09229913701453958, 0.16955801317303934, -0.07148372731171548, 0.01967350095305044, 0.18823687797960112, -0.3813659334966146, 0.25001815561999513, 0.3833710931460647, 0.05200017638066236, 0.17784074658308835, 0.3198067486313555, -0.035530653480878645, -0.03404140136862064, 0.162782493595253, 0.15062985454877728, -0.24540430789484696, 0.3386933242573458, 0.36186585104202523, 0.2691750107606983, 0.03416088311111226, 0.31389500748585253, 0.312107584274867, -0.10433144105927032, -0.3836376651272397, 0.2972084024154088, -0.6427907619406196, -0.02037599006229464, -0.01975397965596879, -0.01917274624985807, -0.3492062348215019, 0.0030069002772078793, 0.37541634992093725, 0.3890762195977218, -0.3107219168039806, 0.011016128940836471, -0.09548335507294242, -0.05484269296421724, 0.08966819257201518, -0.21087586189455845, 0.0987373145762831, 0.2748393341693479, 0.09781858188045375, 0.13122976689106403, 0.09311633863869835, -0.225926404216272, -0.1979122817351976, -0.14384636240463486, -0.34236186337383356, -0.13025145698338747, 0.18941636030178735, -0.46063511248897104, 0.6110469416769988, 0.4387834735269494, -0.2201810612836305, -0.23603342466658966, -0.02883164181976634, 0.26983712851720426, -0.2859477240811376, -0.11609293293098316, 0.17015190647148035, -0.1268467802694752, 0.37056951217955963, -0.3423396384014803 ] } ] } ``` -------------------------------- ### Encode Antibody Sequences (cURL) Source: https://api.biolm.ai/index This cURL command demonstrates how to call the BioLM API's AbLang-2 Encode endpoint to get numerical encodings for antibody sequences. It specifies the endpoint URL, authorization token, content type, and the JSON payload containing the sequences and encoding parameters. The response will contain the encoded sequence data. ```curl curl --location 'https://biolm.ai/api/v3/ablang2/encode/' \ --header 'Authorization: Token yOuR123Api456tOkeN' \ --header 'Content-Type: application/json' \ --data '{ \ "params": { \ "include": "seqcoding", \ "align": false \ }, \ "items": [ \ { \ "heavy": "QVQLVQSGAEVKKQ", \ "light": "DVVMTQTPLSLPVTP" \ }, \ { \ "heavy": "QVQLVESGGGSVQPGRSLR", \ "light": "EIVLTQSPGTLSLSPGERA" \ } \ ] \ }' ``` -------------------------------- ### API Authentication using cURL Source: https://context7.com/context7/api_biolm_ai/llms.txt Demonstrates how to authenticate API requests using a token in the Authorization header. This is a prerequisite for all API calls to BioLM.ai. ```bash curl --location 'https://biolm.ai/api/v3/ablang2/predict/' \ --header 'Authorization: Token yOuR123Api456tOkeN' \ --header 'Content-Type: application/json' \ --data '{ \ "items": [ \ { \ "heavy": "QVQLVQSGAEVKKPGASVKVSCK", \ "light": "DIQMTQSPASLSASVGDRVTITC" \ } \ ] \ }' ``` -------------------------------- ### BioLM API Standard Request Structure Source: https://context7.com/context7/api_biolm_ai/llms.txt Demonstrates the generic request template for BioLM API endpoints using cURL, including authentication, content type, and a sample JSON payload with 'params' and 'items' for model-specific configuration and batch input. ```bash # Generic request template curl --location 'https://biolm.ai/api/v3/{model_name}/{operation}/' \ --header 'Authorization: Token YOUR_API_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "params": { "include": "output_type", "align": false }, "items": [ { "heavy": "AMINO_ACID_SEQUENCE", "light": "AMINO_ACID_SEQUENCE" } ] }' ``` -------------------------------- ### BioLM Python SDK - AbLang2 Prediction Source: https://context7.com/context7/api_biolm_ai/llms.txt Shows how to use the BioLM Python SDK to interact with the AbLang2 model for prediction. It includes initializing the client, making a prediction call with specific items and parameters, and iterating through the results to print likelihood scores. ```python from biolmai import BioLMClient client = BioLMClient(api_key="YOUR_API_TOKEN") response = client.ablang2.predict( items=[ { "heavy": "QVQLVQSGAEVKKPGASVKVSCK", "light": "DIQMTQSPASLSASVGDRVTITC" } ], params={"include": "likelihood"} ) for result in response.results: print(f"Likelihood scores: {result.likelihood}") ``` -------------------------------- ### General Request Structure Source: https://context7.com/context7/api_biolm_ai/llms.txt All BioLM API endpoints follow a consistent JSON schema, accepting a 'params' object for model configuration and an 'items' array for batch input. ```APIDOC ## General Request Structure ### Description All endpoints accept a params object for model-specific configuration and an items array for batch input processing. The params object varies by model but commonly includes output type selection (include), alignment options (align), and model-specific hyperparameters. Items are processed independently and results maintain input ordering. ### Method POST ### Endpoint `https://biolm.ai/api/v3/{model_name}/{operation}/` ### Parameters #### Request Body - **params** (object) - Optional - Model-specific configuration parameters. - **include** (string) - Optional - Specifies the type of output to include. - **align** (boolean) - Optional - Whether to include alignment information. - **items** (array) - Required - An array of input items to be processed. - **heavy** (string) - Required for antibody models - Amino acid sequence for the heavy chain. - **light** (string) - Required for antibody models - Amino acid sequence for the light chain. - **sequence** (string) - Required for protein/DNA/RNA models - The input sequence. ### Request Example ```json { "params": { "include": "output_type", "align": false }, "items": [ { "heavy": "AMINO_ACID_SEQUENCE", "light": "AMINO_ACID_SEQUENCE" } ] } ``` ### Response #### Success Response (200) - **results** (array) - An array of results, maintaining the order of the input items. - **likelihood** (number) - Likelihood scores for the prediction. - **pdb_string** (string) - PDB formatted structure data (if requested). #### Response Example ```json { "results": [ { "likelihood": 0.95, "pdb_string": "..." } ] } ``` ``` -------------------------------- ### API Authentication Source: https://context7.com/context7/api_biolm_ai/llms.txt All requests to the BioLM.ai API require token-based authentication. Include your API token in the Authorization header. ```APIDOC ## API Authentication Token-based authentication with API key header All requests require an Authorization header with your API token obtained from the BioLM API Tokens page. ```bash curl --location 'https://biolm.ai/api/v3/ablang2/predict/' \ --header 'Authorization: Token yOuR123Api456tOkeN' \ --header 'Content-Type: application/json' \ --data '{ \ "items": [ \ { \ "heavy": "QVQLVQSGAEVKKPGASVKVSCK", \ "light": "DIQMTQSPASLSASVGDRVTITC" \ } \ ] \ }' ``` ``` -------------------------------- ### Asynchronous Batch Processing Source: https://context7.com/context7/api_biolm_ai/llms.txt Handles asynchronous batch processing for large datasets, suitable for high-performance computing and large-scale analyses. ```APIDOC ## POST /api/v3/ablang2/encode_async ### Description Provides asynchronous processing for batch requests, allowing for efficient handling of large datasets by processing sequences in chunks. ### Method POST ### Endpoint /api/v3/ablang2/encode_async ### Parameters #### Request Body - **params** (object) - Optional - Parameters for the encoding process, such as 'include' (e.g., 'seqcoding'). - **items** (array[object]) - Required - An array of antibody sequence objects, where each object contains 'heavy' and 'light' chain sequences. - **heavy** (string) - Required - The heavy chain sequence. - **light** (string) - Required - The light chain sequence. ### Request Example ```json { "params": { "include": "seqcoding" }, "items": [ {"heavy": "SEQ1_HEAVY", "light": "SEQ1_LIGHT"}, {"heavy": "SEQ2_HEAVY", "light": "SEQ2_LIGHT"} ] } ``` ### Response #### Success Response (200) - **results** (array[object]) - An array of results, where each object corresponds to an input sequence. - **seqcoding** (array) - The embedding vector for the antibody sequence. #### Response Example ```json { "results": [ { "seqcoding": [0.1, 0.2, 0.3, ...] }, { "seqcoding": [0.4, 0.5, 0.6, ...] } ] } ``` ``` -------------------------------- ### Python SDK: Async Batch Processing for Large Datasets Source: https://context7.com/context7/api_biolm_ai/llms.txt This Python code demonstrates asynchronous batch processing for large datasets using the BioLM SDK. It defines an async function `process_large_batch` that handles processing sequences in smaller chunks to manage resources effectively. This approach is suitable for large-scale analyses where efficiency and non-blocking operations are critical. ```python # Example 3: Async batch processing for large datasets import asyncio async def process_large_batch(sequences, batch_size=50): results = [] for i in range(0, len(sequences), batch_size): batch = sequences[i:i+batch_size] response = await client.ablang2.encode_async( items=batch, params={"include": "seqcoding"} ) results.extend(response.results) return results # Process 1000 sequences large_dataset = [{"heavy": f"SEQ{i}", "light": f"SEQ{i}"} for i in range(1000)] all_results = asyncio.run(process_large_batch(large_dataset)) ``` -------------------------------- ### Error Handling Source: https://context7.com/context7/api_biolm_ai/llms.txt The API utilizes standard HTTP status codes and provides JSON error messages for robust error handling and debugging. ```APIDOC ## Error Handling ### Description All endpoints return standard HTTP status codes with JSON error messages. Common errors include 401 Unauthorized, 400 Bad Request, 429 Too Many Requests, and 500 Internal Server Error. Error responses include descriptive messages to aid debugging. ### Common Error Codes - **401 Unauthorized**: Invalid or missing API token. - **400 Bad Request**: Malformed input data or incorrect request format. - **429 Too Many Requests**: Rate limiting has been exceeded. - **500 Internal Server Error**: An unexpected error occurred on the server. ### Error Response Example (401 Unauthorized) ```json { "error": "Invalid authentication token", "status": 401 } ``` ### Error Response Example (400 Bad Request) ```json { "error": "Invalid request format: items must be an array", "status": 400 } ``` ``` -------------------------------- ### POST /api/v3/ablang2/encode/ Source: https://context7.com/context7/api_biolm_ai/llms.txt Generate antibody embeddings. Produces dense vector embeddings representing antibody sequences in latent space for similarity searches and downstream ML tasks. ```APIDOC ## POST /api/v3/ablang2/encode/ ### Description Generates dense vector embeddings representing antibody sequences in latent space. Produces fixed-length numerical representations that capture semantic properties of antibody sequences, enabling similarity searches, clustering, and classification. ### Method POST ### Endpoint `/api/v3/ablang2/encode/` ### Parameters #### Query Parameters - **include** (string) - Optional - Specifies the type of data to include in the response (e.g., "seqcoding"). - **align** (boolean) - Optional - Whether to align sequences before encoding. #### Request Body - **params** (object) - Optional - Contains additional parameters for the encoding process. - **include** (string) - Optional - Specifies the type of data to include in the response. - **align** (boolean) - Optional - Whether to align sequences before encoding. - **items** (array) - Required - A list of antibody sequences to process. - **heavy** (string) - Required - The heavy chain sequence. - **light** (string) - Required - The light chain sequence. ### Request Example ```json { "params": { "include": "seqcoding", "align": false }, "items": [ { "heavy": "QVQLVQSGAEVKKQ", "light": "DVVMTQTPLSLPVTP" }, { "heavy": "QVQLVESGGGSVQPGRSLR", "light": "EIVLTQSPGTLSLSPGERA" } ] } ``` ### Response #### Success Response (200) - **results** (array) - A list of encoding results for each input sequence. - **seqcoding** (array) - Array of numerical embeddings representing the antibody sequence. #### Response Example ```json { "results": [ { "seqcoding": [ -0.21477425201138592, -0.12190765886129264, -0.09134528583244365, -0.06957388422725831, 0.14344040571492822, 0.23156739771270752, -0.08445963263511658, 0.19837358593940735, 0.017336526073428782 ] }, { "seqcoding": [ -0.18234567890123456, -0.10987654321098765, 0.07654321098765432 ] } ] } ``` ``` -------------------------------- ### Batch Processing - Process multiple sequences efficiently Source: https://context7.com/context7/api_biolm_ai/llms.txt Optimize throughput with array-based batch requests for processing multiple sequences in a single API call. Results maintain the same order as inputs. ```APIDOC ## POST /api/v3/ablang2/encode ### Description Processes multiple antibody sequences (heavy and light chains) in a single API call to generate embeddings. This method is optimized for high throughput and reduces network overhead. ### Method POST ### Endpoint /api/v3/ablang2/encode ### Parameters #### Request Body - **params** (object) - Optional - Parameters for the encoding process, such as 'include' (e.g., 'seqcoding') and 'align' (boolean). - **items** (array[object]) - Required - An array of antibody sequence objects, where each object contains 'heavy' and 'light' chain sequences. - **heavy** (string) - Required - The heavy chain sequence. - **light** (string) - Required - The light chain sequence. ### Request Example ```json { "params": { "include": "seqcoding", "align": false }, "items": [ {"heavy": "QVQLVQSGAEVKKPGASVKVSCK", "light": "DIQMTQSPASLSASVGDRVTITC"}, {"heavy": "EVQLVESGGGLVKPGGSLKLSCA", "light": "KVVMTQSPDSLSASLGDRVTITC"} ] } ``` ### Response #### Success Response (200) - **results** (array[object]) - An array of results, where each object corresponds to an input sequence. - **seqcoding** (array) - The embedding vector for the antibody sequence. #### Response Example ```json { "results": [ { "seqcoding": [0.1, 0.2, 0.3, ...] }, { "seqcoding": [0.4, 0.5, 0.6, ...] } ] } ``` ``` -------------------------------- ### Python SDK: Generate Embeddings for Similarity Search Source: https://context7.com/context7/api_biolm_ai/llms.txt This Python snippet shows how to generate sequence embeddings using the BioLM SDK for similarity search applications. It details the process of encoding antibody sequences and then utilizing these embeddings with scikit-learn's `cosine_similarity` function to calculate the similarity between antibody pairs. This is crucial for tasks like finding similar antibody candidates. ```python # Example 2: Generate embeddings for similarity search embeddings_response = client.ablang2.encode( items=antibodies, params={"include": "seqcoding", "align": False} ) embeddings = [result.seqcoding for result in embeddings_response.results] embedding_matrix = np.array(embeddings) # Calculate cosine similarity from sklearn.metrics.pairwise import cosine_similarity similarity = cosine_similarity(embedding_matrix) print(f"Antibody similarity: {similarity[0][1]:.3f}") ``` -------------------------------- ### Process Multiple Antibody Pairs with Curl Source: https://context7.com/context7/api_biolm_ai/llms.txt This snippet demonstrates how to process multiple antibody pairs (heavy and light chains) efficiently in a single API call using curl. It showcases the batch request format, where sequences are provided in an 'items' array. This method reduces network overhead for large-scale analyses. ```bash # Process 5 antibody pairs in one request curl --location 'https://biolm.ai/api/v3/ablang2/encode/' \ --header 'Authorization: Token YOUR_API_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "params": { "include": "seqcoding", "align": false }, "items": [ {"heavy": "QVQLVQSGAEVKKPGASVKVSCK", "light": "DIQMTQSPASLSASVGDRVTITC"}, {"heavy": "EVQLVESGGGLVKPGGSLKLSCA", "light": "KVVMTQSPDSLSASLGDRVTITC"}, {"heavy": "QVQLQQSGAELARPGASVKMSCKA", "light": "DIVMTQAAPSVPVTPGESVSISCK"}, {"heavy": "QVQLVQSGGGVVQPGRSLRLSCAA", "light": "QIVLTQSPAIMSASPGEKVTMTCSA"}, {"heavy": "EVQLVETGGGLVQPGGSLRLSCAA", "light": "DIQMTQSPSSLSASVGDRVTITCKA"} ] }' ``` -------------------------------- ### ESM-2 Protein Language Model - Embeddings Source: https://context7.com/context7/api_biolm_ai/llms.txt Generates embeddings for protein sequences using the ESM-2 language model. ```APIDOC ## ESM-2 Protein Language Model - Embeddings ### Description This endpoint uses the ESM-2 model to generate embeddings for protein sequences. ### Method POST ### Endpoint `https://biolm.ai/api/v3/esm2/embed/` ### Parameters #### Request Body - **items** (array) - Required - An array of input items. - **sequence** (string) - Required - The protein sequence for which to generate embeddings. ### Request Example ```json { "items": [ {"sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSGAEKAVQVK"} ] } ``` ### Response #### Success Response (200) - **embeddings** (array) - A list of embeddings corresponding to the input sequences. ``` -------------------------------- ### AbLang-2 Predict API Request (JSON) Source: https://api.biolm.ai/index This JSON structure defines the input for the AbLang-2 Predict API. It requires 'params' (with 'include' for likelihood) and a list of 'items', where each item contains 'heavy' and 'light' antibody chain sequences. No external dependencies are needed beyond standard JSON parsing. ```json { "params": { "include": "likelihood" }, "items": [ { "heavy": "QVQLVQSGAEVKKPGASVKVSCK", "light": "DIQMTQSPASLSASVGDRVTITC" }, { "heavy": "EVQLVESGGGLVKPGGSLKLSCA", "light": "KVVMTQSPDSLSASLGDRVTITC" } ] } ``` -------------------------------- ### AbLang-2 Predict: Antibody Sequence Likelihoods using cURL Source: https://context7.com/context7/api_biolm_ai/llms.txt Calculates log-likelihood scores for antibody sequences using the AbLang-2 model. The response includes position-wise likelihoods, useful for sequence optimization and developability assessment. Requires API authentication. ```bash curl --location 'https://biolm.ai/api/v3/ablang2/predict/' \ --header 'Authorization: Token yOuR123Api456tOkeN' \ --header 'Content-Type: application/json' \ --data '{ \ "params": { \ "include": "likelihood" \ }, \ "items": [ \ { \ "heavy": "QVQLVQSGAEVKKPGASVKVSCK", \ "light": "DIQMTQSPASLSASVGDRVTITC" \ }, \ { \ "heavy": "EVQLVESGGGLVKPGGSLKLSCA", \ "light": "KVVMTQSPDSLSASLGDRVTITC" \ } \ ] \ }' # Response (200 OK): # { # "results": [ # { # "likelihood": [ # [-4.100, -3.792, -6.290, -10.525, -4.282, -2.594, 1.645, -1.646, -2.661, 0.632, -5.690, -2.494, -2.490, -1.938, -3.525, -5.701, -4.643, -5.037, -3.795, -4.552], # [-4.930, -2.364, 0.474, -7.699, -2.953, 1.640, -0.667, -4.099, -2.640, 5.982, -4.148, -1.182, -1.697, -3.158, -4.485, -7.662, -4.930, -3.154, -2.766, -3.263] # ], # "sequence_tokens": ["<", "Q", "V", "Q", "L", "V", "Q", "S", "G", "A", "E", "V", "K", "K", "P", "G", "A", "S", "V", "K", "V", "S", "C", "K", ">", "|", "<", "D", "I", "Q", "M", "T", "Q", "S", "P", "A", "S", "L", "S", "A", "S", "V", "G", "D", "R", "V", "T", "I", "T", "C", ">"], # "sequence_tokens": ["M", "R", "H", "K", "D", "E", "S", "T", "N", "Q", "C", "G", "P", "A", "V", "I", "F", "Y", "W", "L"] # }, # { # "likelihood": [...], # "sequence_tokens": [...], # "vocab_tokens": [...] # } # ] # } ``` -------------------------------- ### AbLang-2 Encode: Antibody Embeddings using cURL Source: https://context7.com/context7/api_biolm_ai/llms.txt Generates dense vector embeddings for antibody sequences using the AbLang-2 model. These embeddings capture semantic properties and are used for similarity searches, clustering, and other downstream ML tasks. Requires API authentication. ```bash curl --location 'https://biolm.ai/api/v3/ablang2/encode/' \ --header 'Authorization: Token yOuR123Api456tOkeN' \ --header 'Content-Type: application/json' \ --data '{ \ "params": { \ "include": "seqcoding", \ "align": false \ }, \ "items": [ \ { \ "heavy": "QVQLVQSGAEVKKQ", \ "light": "DVVMTQTPLSLPVTP" \ }, \ { \ "heavy": "QVQLVESGGGSVQPGRSLR", \ "light": "EIVLTQSPGTLSLSPGERA" \ } \ ] \ }' # Response (200 OK): # { # "results": [ # { # "seqcoding": [ # -0.21477425201138592, # -0.12190765886129264, # -0.09134528583244365, # -0.06957388422725831, # 0.14344040571492822, # 0.23156739771270752, # -0.08445963263511658, # 0.19837358593940735, # 0.017336526073428782 # ] # }, # { # "seqcoding": [ # -0.18234567890123456, # -0.10987654321098765, # 0.07654321098765432 # ] # } # ] # } ``` -------------------------------- ### AbLang-2 Predict API Request (cURL) Source: https://api.biolm.ai/index This cURL command demonstrates how to send a POST request to the AbLang-2 Predict API. It includes the necessary Authorization header with an API key, the Content-Type as application/json, and the JSON payload containing antibody sequences for prediction. Ensure your API key is correctly substituted. ```curl curl --location 'https://biolm.ai/api/v3/ablang2/predict/' \ --header 'Authorization: Token yOuR123Api456tOkeN' \ --header 'Content-Type: application/json' \ --data '{ "params": { "include": "likelihood" }, "items": [ { "heavy": "QVQLVQSGAEVKKPGASVKVSCK", "light": "DIQMTQSPASLSASVGDRVTITC" }, { "heavy": "EVQLVESGGGLVKPGGSLKLSCA", "light": "KVVMTQSPDSLSASLGDRVTITC" } ] }' ``` -------------------------------- ### BioLM API - ESM-2 Protein Embedding Request Source: https://context7.com/context7/api_biolm_ai/llms.txt Illustrates how to make a request to the BioLM API's ESM-2 model endpoint to obtain embeddings for protein sequences. It uses cURL with appropriate headers and a JSON payload specifying the sequence in the 'items' array. ```bash # ESM-2 protein language model example (URL pattern inference) curl --location 'https://biolm.ai/api/v3/esm2/embed/' \ --header 'Authorization: Token YOUR_API_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "items": [ {"sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSGAEKAVQVK"} ] }' ```