Where can I find 'DLAI_TOGETHER_API_BASE'

Hi Everyone
I see that a specific environment variable is required in the utils.py helper file

url = f"{os.getenv(‘DLAI_TOGETHER_API_BASE’, ‘https://api.together.xyz’)}/inference"

Where can I find the variable DLAI_TOGETHER_API_BASE?

Thanks in advance
Fabio

I’m going to guess that’s in the dotenv resource, which is not publicly available.

1 Like

Hi @TMosh
I have just realized that the os.getenv function takes two arguments: the name of the environment variable and a default value. If the environment variable DLAI_TOGETHER_API_BASE is set, os.getenv will return its value. If it’s not set, os.getenv will return the default value, which is 'https://api.together.xyz' in this case.

In the ‘utils.py’ file there is another environment variable called ‘TOGETHER_API_KEY’.

headers = {
“Authorization”: f"Bearer {os.getenv(‘TOGETHER_API_KEY’)}",
“Content-Type”: “application/json”
}

This variable should be created from ’ TOGETHER’ .
Now I can run locally the Jupyter Notebook.
Hope this can help anyone else.

1 Like

Thanks for your report.

I think is some coder that need to complicate the life of the rest of people ;(, would be easier to simply write a constant at the begining of utils.py:

url = ‘https://api.together.xyz/inference

as same kind of constant, and if in a future this url changes, only have to change it once in the definition.

And as pointed out is different the TOGETHER_API_KEY, obtained from the web together.ai, when you register…and the base url of the API Together.