diff --git a/openapi.yaml b/openapi.yaml index 0444fde..a046e46 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -962,9 +962,9 @@ paths: $ref: '#/components/schemas/ListVoicesResponse' x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -976,7 +976,7 @@ paths: print(response.data) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -1022,9 +1022,9 @@ paths: operationId: retrieveVideo x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -1036,7 +1036,7 @@ paths: print(response.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -1100,9 +1100,9 @@ paths: - url: https://api.together.xyz/v2 x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -1117,7 +1117,7 @@ paths: print(response.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -1181,9 +1181,9 @@ paths: description: Generate a model response for a given chat conversation. Supports single queries and multi-turn conversations with system, user, and assistant messages. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -1198,10 +1198,8 @@ paths: {"role": "user", "content": "What are some fun things to do in New York?"}, ] ) - - print(response.choices[0].message.content) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -1217,6 +1215,8 @@ paths: {"role": "user", "content": "What are some fun things to do in New York?"}, ] ) + + print(response.choices[0].message.content) - lang: TypeScript label: Together AI SDK (TypeScript) source: | @@ -1326,9 +1326,9 @@ paths: description: Generate text completions for a given prompt using a language, code, or image model. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -1344,7 +1344,7 @@ paths: print(response.choices[0].text) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -1463,9 +1463,9 @@ paths: description: Generate vector embeddings for one or more text inputs. Returns numerical arrays representing semantic meaning, useful for search, classification, and retrieval. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -1480,7 +1480,7 @@ paths: print(response.data[0].embedding) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -1592,9 +1592,9 @@ paths: description: Lists all of Together's open-source models x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -1607,7 +1607,7 @@ paths: for model in models: print(model.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -1705,9 +1705,9 @@ paths: description: Upload a custom model or adapter from Hugging Face or S3 x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -1716,13 +1716,13 @@ paths: ) response = client.models.upload( - "My-Fine-Tuned-Model", - "https://ml-models.s3.us-west-2.amazonaws.com/models/my-fine-tuned-model.tar.gz", + model_name="My-Fine-Tuned-Model", + model_source="https://ml-models.s3.us-west-2.amazonaws.com/models/my-fine-tuned-model.tar.gz", ) - print(response.job_id) + print(response.data.job_id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -1732,11 +1732,11 @@ paths: ) response = client.models.upload( - model_name="My-Fine-Tuned-Model", - model_source="https://ml-models.s3.us-west-2.amazonaws.com/models/my-fine-tuned-model.tar.gz", + "My-Fine-Tuned-Model", + "https://ml-models.s3.us-west-2.amazonaws.com/models/my-fine-tuned-model.tar.gz", ) - print(response.data.job_id) + print(response.job_id) - lang: TypeScript label: Together AI SDK (TypeScript) source: | @@ -1835,9 +1835,9 @@ paths: description: Use an image model to generate an image for a given prompt. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -1853,7 +1853,7 @@ paths: print(response.data[0].url) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2015,9 +2015,9 @@ paths: description: List the metadata for all uploaded data files. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2030,7 +2030,7 @@ paths: for file in response.data: print(file.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2091,9 +2091,9 @@ paths: description: Retrieve the metadata for a single uploaded data file. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2105,7 +2105,7 @@ paths: print(file) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2167,9 +2167,9 @@ paths: description: Delete a previously uploaded data file. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2181,7 +2181,7 @@ paths: print(response) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2243,9 +2243,9 @@ paths: description: Get the contents of a single uploaded data file. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2253,11 +2253,11 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - file = client.files.retrieve_content(id="file-id") - - print(file.filename) + with client.files.with_streaming_response.content(id="file-id") as response: + for line in response.iter_lines(): + print(line) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2266,9 +2266,9 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - with client.files.with_streaming_response.content(id="file-id") as response: - for line in response.iter_lines(): - print(line) + file = client.files.retrieve_content(id="file-id") + + print(file.filename) - lang: TypeScript label: Together AI SDK (TypeScript) source: | @@ -2329,9 +2329,9 @@ paths: description: Upload a file with specified purpose, file name, and file type. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2345,7 +2345,7 @@ paths: print(file.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2448,9 +2448,9 @@ paths: description: Create a fine-tuning job with the provided model and training data. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2465,7 +2465,7 @@ paths: print(response) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2650,9 +2650,9 @@ paths: description: List the metadata for all fine-tuning jobs. Returns a list of FinetuneResponseTruncated objects. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2665,7 +2665,7 @@ paths: for fine_tune in response.data: print(f"ID: {fine_tune.id}, Status: {fine_tune.status}") - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2801,9 +2801,9 @@ paths: description: List the metadata for a single fine-tuning job. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2815,7 +2815,7 @@ paths: print(fine_tune) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2877,9 +2877,9 @@ paths: description: Delete a fine-tuning job. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2891,7 +2891,7 @@ paths: print(response) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2973,9 +2973,9 @@ paths: description: List the events for a single fine-tuning job. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -2983,11 +2983,12 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - events = client.fine_tuning.list_events(id="ft-id") + response = client.fine_tuning.list_events(id="ft-id") - print(events) + for event in response.data: + print(event) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -2996,10 +2997,9 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.fine_tuning.list_events(id="ft-id") + events = client.fine_tuning.list_events(id="ft-id") - for event in response.data: - print(event) + print(events) - lang: TypeScript label: Together AI SDK (TypeScript) source: | @@ -3051,9 +3051,9 @@ paths: description: List the checkpoints for a single fine-tuning job. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -3065,7 +3065,7 @@ paths: print(checkpoints) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -3128,9 +3128,9 @@ paths: description: Receive a compressed fine-tuned model or checkpoint. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -3138,12 +3138,15 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - # This will download the content to a location on disk - response = client.fine_tuning.download(id="ft-id") + # Using `with_streaming_response` gives you control to do what you want with the response. + stream = client.fine_tuning.with_streaming_response.content(ft_id="ft-id") + + with stream as response: + for line in response.iter_lines(): + print(line) - print(response) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -3152,13 +3155,10 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - # Using `with_streaming_response` gives you control to do what you want with the response. - stream = client.fine_tuning.with_streaming_response.content(ft_id="ft-id") - - with stream as response: - for line in response.iter_lines(): - print(line) + # This will download the content to a location on disk + response = client.fine_tuning.download(id="ft-id") + print(response) - lang: TypeScript label: Together AI SDK (TypeScript) source: | @@ -3234,9 +3234,9 @@ paths: description: Cancel a currently running fine-tuning job. Returns a FinetuneResponseTruncated object. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -3248,7 +3248,7 @@ paths: print(response) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -3315,9 +3315,9 @@ paths: description: Rerank a list of documents by relevance to a query. Returns a relevance score and ordering index for each document. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -3355,7 +3355,7 @@ paths: print(f"Title: {documents[result.index]['title']}") print(f"Text: {documents[result.index]['text']}") - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -3550,9 +3550,9 @@ paths: description: Generate audio from input text x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -3560,15 +3560,16 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.audio.speech.create( + response = client.audio.speech.with_streaming_response.create( model="cartesia/sonic-2", input="The quick brown fox jumps over the lazy dog.", voice="laidback woman", ) - response.stream_to_file("audio.wav") + with response as stream: + stream.stream_to_file("audio.wav") - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -3577,14 +3578,13 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.audio.speech.with_streaming_response.create( + response = client.audio.speech.create( model="cartesia/sonic-2", input="The quick brown fox jumps over the lazy dog.", voice="laidback woman", ) - with response as stream: - stream.stream_to_file("audio.wav") + response.stream_to_file("audio.wav") - lang: TypeScript label: Together AI SDK (TypeScript) source: | @@ -3995,9 +3995,9 @@ paths: description: Transcribes audio into text x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together client = Together( @@ -4013,7 +4013,7 @@ paths: print(response.text) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together @@ -4117,9 +4117,9 @@ paths: description: Translates audio into English x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -4137,7 +4137,7 @@ paths: print(response.text) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -4910,9 +4910,9 @@ paths: description: Returns a list of all endpoints associated with your account. You can filter the results by type (dedicated or serverless). x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -4920,12 +4920,12 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - endpoints = client.endpoints.list() + response = client.endpoints.list() - for endpoint in endpoints: + for endpoint in response.data: print(endpoint.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -4934,9 +4934,9 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.endpoints.list() + endpoints = client.endpoints.list() - for endpoint in response.data: + for endpoint in endpoints: print(endpoint.id) - lang: TypeScript label: Together AI SDK (TypeScript) @@ -5045,9 +5045,9 @@ paths: description: Creates a new dedicated endpoint for serving models. The endpoint will automatically start after creation. You can deploy any supported model on hardware configurations that meet the model's requirements. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -5058,13 +5058,15 @@ paths: endpoint = client.endpoints.create( model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo", hardware="1x_nvidia_a100_80gb_sxm", - min_replicas=2, - max_replicas=5, + autoscaling={ + "min_replicas": 2, + "max_replicas": 5, + } ) print(endpoint.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -5076,10 +5078,8 @@ paths: endpoint = client.endpoints.create( model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo", hardware="1x_nvidia_a100_80gb_sxm", - autoscaling={ - "min_replicas": 2, - "max_replicas": 5, - } + min_replicas=2, + max_replicas=5, ) print(endpoint.id) @@ -5169,9 +5169,9 @@ paths: description: Retrieves details about a specific endpoint, including its current state, configuration, and scaling settings. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -5179,11 +5179,11 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - endpoint = client.endpoints.get("endpoint-id") + endpoint = client.endpoints.retrieve("endpoint-id") print(endpoint.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -5192,7 +5192,7 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - endpoint = client.endpoints.retrieve("endpoint-id") + endpoint = client.endpoints.get("endpoint-id") print(endpoint.id) - lang: TypeScript @@ -5265,10 +5265,26 @@ paths: summary: Update endpoint, this can also be used to start or stop a dedicated endpoint description: Updates an existing endpoint's configuration. You can modify the display name, autoscaling settings, or change the endpoint's state (start/stop). x-codeSamples: + - lang: Python + label: Together AI SDK (v2) + source: | + # Docs for v1 can be found by changing the above selector ^ + from together import Together + import os + + client = Together( + api_key=os.environ.get("TOGETHER_API_KEY"), + ) + + endpoint = client.endpoints.update( + "endpoint-id", + state="STOPPED" + ) + + print(endpoint) - lang: Python label: Together AI SDK (v1) source: | - # Docs for v2 can be found by changing the above selector ^ from together import Together import os @@ -5385,10 +5401,23 @@ paths: summary: Delete endpoint description: Permanently deletes an endpoint. This action cannot be undone. x-codeSamples: + - lang: Python + label: Together AI SDK (v2) + source: | + # Docs for v1 can be found by changing the above selector ^ + from together import Together + import os + + client = Together( + api_key=os.environ.get("TOGETHER_API_KEY"), + ) + + endpoint = client.endpoints.delete("endpoint-id") + + print(endpoint) - lang: Python label: Together AI SDK (v1) source: | - # Docs for v2 can be found by changing the above selector ^ from together import Together import os @@ -5471,9 +5500,9 @@ paths: with that model, including their current availability status. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -5483,10 +5512,10 @@ paths: response = client.endpoints.list_hardware() - for hardware in response: + for hardware in response.data: print(hardware.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -5497,7 +5526,7 @@ paths: response = client.endpoints.list_hardware() - for hardware in response.data: + for hardware in response: print(hardware.id) - lang: TypeScript label: Together AI SDK (TypeScript) @@ -5579,9 +5608,9 @@ paths: between calls to the same session. x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -5589,14 +5618,14 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.code_interpreter.run( + response = client.code_interpreter.execute( code="print('Hello world!')", language="python", ) print(response.data.outputs[0].data); - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -5605,7 +5634,7 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.code_interpreter.execute( + response = client.code_interpreter.run( code="print('Hello world!')", language="python", ) @@ -5674,14 +5703,10 @@ paths: description: | Lists all your currently active sessions. x-codeSamples: - - lang: Python - label: Together AI SDK (v1) - source: | - # Docs for v2 can be found by changing the above selector ^ - # together v1 does not support this method - lang: Python label: Together AI SDK (v2) source: | + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -5693,6 +5718,10 @@ paths: for session in response.data.sessions: print(session.id) + - lang: Python + label: Together AI SDK (v1) + source: | + # together v1 does not support this method - lang: TypeScript label: Together AI SDK (TypeScript) source: | @@ -5743,9 +5772,9 @@ paths: description: List all batch jobs for the authenticated user x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -5753,12 +5782,12 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - batches = client.batches.list_batches() + batches = client.batches.list() for batch in batches: print(batch.id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -5767,7 +5796,7 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - batches = client.batches.list() + batches = client.batches.list_batches() for batch in batches: print(batch.id) @@ -5830,9 +5859,9 @@ paths: description: Create a new batch job with the given input file and endpoint x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -5840,11 +5869,11 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - batch = client.batches.create_batch("file_id", endpoint="/v1/chat/completions") + batch = client.batches.create(input_file_id="file_id", endpoint="/v1/chat/completions") - print(batch.id) + print(batch.job) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -5853,9 +5882,9 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - batch = client.batches.create(input_file_id="file_id", endpoint="/v1/chat/completions") + batch = client.batches.create_batch("file_id", endpoint="/v1/chat/completions") - print(batch.job) + print(batch.id) - lang: TypeScript label: Together AI SDK (TypeScript) source: | @@ -5943,9 +5972,9 @@ paths: description: Get details of a batch job by ID x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -5953,11 +5982,11 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - batch = client.batches.get_batch("batch_id") + batch = client.batches.retrieve("batch_id") print(batch) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -5966,7 +5995,7 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - batch = client.batches.retrieve("batch_id") + batch = client.batches.get_batch("batch_id") print(batch) - lang: TypeScript @@ -6053,9 +6082,9 @@ paths: description: Cancel a batch job by ID x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -6067,7 +6096,7 @@ paths: print(batch) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -6163,31 +6192,10 @@ paths: summary: Create an evaluation job operationId: createEvaluationJob x-codeSamples: - - lang: Python - label: Together AI SDK (v1) - source: | - # Docs for v2 can be found by changing the above selector ^ - from together import Together - import os - - client = Together( - api_key=os.environ.get("TOGETHER_API_KEY"), - ) - - response = client.evaluation.create( - type="classify", - judge_model_name="meta-llama/Llama-3.1-70B-Instruct-Turbo", - judge_system_template="You are an expert evaluator...", - input_data_file_path="file-abc123", - labels=["good", "bad"], - pass_labels=["good"], - model_to_evaluate="meta-llama/Llama-3.1-8B-Instruct-Turbo" - ) - - print(response.workflow_id) - lang: Python label: Together AI SDK (v2) source: | + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -6210,6 +6218,27 @@ paths: ) ) + print(response.workflow_id) + - lang: Python + label: Together AI SDK (v1) + source: | + from together import Together + import os + + client = Together( + api_key=os.environ.get("TOGETHER_API_KEY"), + ) + + response = client.evaluation.create( + type="classify", + judge_model_name="meta-llama/Llama-3.1-70B-Instruct-Turbo", + judge_system_template="You are an expert evaluator...", + input_data_file_path="file-abc123", + labels=["good", "bad"], + pass_labels=["good"], + model_to_evaluate="meta-llama/Llama-3.1-8B-Instruct-Turbo" + ) + print(response.workflow_id) - lang: TypeScript label: Together AI SDK (TypeScript) @@ -6295,9 +6324,9 @@ paths: operationId: getAllEvaluationJobs x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -6305,12 +6334,12 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - jobs = client.evaluation.list() + response = client.evals.list() - for job in jobs: + for job in response: print(job.workflow_id) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -6319,9 +6348,9 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.evals.list() + jobs = client.evaluation.list() - for job in response: + for job in jobs: print(job.workflow_id) - lang: TypeScript label: Together AI SDK (TypeScript) @@ -6433,9 +6462,9 @@ paths: operationId: getEvaluationJobDetails x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -6443,11 +6472,11 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.evaluation.retrieve('eval_id') + response = client.evals.retrieve('eval_id') print(response) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -6456,7 +6485,7 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.evals.retrieve('eval_id') + response = client.evaluation.retrieve('eval_id') print(response) - lang: TypeScript @@ -6518,9 +6547,9 @@ paths: operationId: getEvaluationJobStatusAndResults x-codeSamples: - lang: Python - label: Together AI SDK (v1) + label: Together AI SDK (v2) source: | - # Docs for v2 can be found by changing the above selector ^ + # Docs for v1 can be found by changing the above selector ^ from together import Together import os @@ -6528,12 +6557,12 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.evaluation.status('eval_id') + response = client.evals.status('eval_id') print(response.status) print(response.results) - lang: Python - label: Together AI SDK (v2) + label: Together AI SDK (v1) source: | from together import Together import os @@ -6542,7 +6571,7 @@ paths: api_key=os.environ.get("TOGETHER_API_KEY"), ) - response = client.evals.status('eval_id') + response = client.evaluation.status('eval_id') print(response.status) print(response.results)