# Setting env variables in WCS

**URL:** <https://forum.weaviate.io/t/setting-env-variables-in-wcs/1042>\
**Category:** Support\
**Created:** [November 29, 2023, 10:58am UTC](https://forum.weaviate.io/t/setting-env-variables-in-wcs/1042 "2023-11-29T10:58:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kristian](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/kristian/32/551_2.png) [@Kristian](https://forum.weaviate.io/u/Kristian)\
**Post date:** [November 29, 2023, 10:58am UTC](https://forum.weaviate.io/t/setting-env-variables-in-wcs/1042/1 "2023-11-29T10:58:37Z")

</div>

Hi! I want to test the Cohere [rerank module](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/reranker-cohere) on my WCS database, and to do that I need to pass a Cohere API key with my requests.

I’m building my project using Flowise, and currently there’s no way to pass the key in a HTTP header through it. Is there a way I can set the API key as an environment variable for my database instead? How would I do that?

---

<div class="post-metadata">

**Author:** ![Kristian](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/kristian/32/551_2.png) [@Kristian](https://forum.weaviate.io/u/Kristian)\
**Post date:** [November 29, 2023, 11:02pm UTC](https://forum.weaviate.io/t/setting-env-variables-in-wcs/1042/2 "2023-11-29T23:02:56Z")

</div>

I tried setting up a sandbox cluster like this, adding my Cohere key:  
import weaviate

client = weaviate.Client(  
url=“endpoint”, # Replace with your endpoint  
auth\_client\_secret=weaviate.AuthApiKey(api\_key=“key”), # Replace with your Weaviate instance API key  
additional\_headers={  
“X-Cohere-Api-Key”: “key”  
}  
)

if client.is\_ready():  
print(“Weaviate is ready!”)  
else:  
print(“Weaviate is not ready.”)

Then I set the class chema like this:  
import weaviate

client = weaviate.Client(  
url=“endpoint”, # Replace with your endpoint  
auth\_client\_secret=weaviate.AuthApiKey(api\_key=“key”), # Replace with your Weaviate instance API key  
)

#Define the class schema  
class\_obj = {  
“class”: “Reranktest”,  
“vectorizer”: “none”,  
“vectorIndexType”: “hnsw”,  
“vectorIndexConfig”: {  
“distance”: “dot”,  
“efConstruction”: 254, # Higher value for accuracy, as per the documentation  
“maxConnections”: 32, # Recommended starting value from the documentation  
“ef”: 64 # Recommended starting value from the documentation  
},  
“moduleConfig”: {  
“reranker-cohere”: {  
“model”: “rerank-multilingual-v2.0”,  
}  
}  
}

#Create the class  
client.schema.create\_class(class\_obj)  
print(“Class ‘Reranktest’ created successfully!”)

I can query the database as usual, but I’m getting the same similarity scores as when I used no reranker. Checking the debug log I don’t see the results having been reranked (not like the [example responses](https://docs.cohere.com/docs/reranking#example-response) over at Cohere). What am I missing?

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [November 30, 2023, 1:51pm UTC](https://forum.weaviate.io/t/setting-env-variables-in-wcs/1042/3 "2023-11-30T13:51:17Z")

</div>

Hi!

On top of defining the reranker module, you need to explicitly ask for a rerank in your query.

here we have a nice recipes, one of them on reranking:

> <https://github.com/weaviate/recipes/tree/main/ranking>
>
> //github.com/weaviate/recipes/tree/main/ranking

Let me know if that helps 🙂

---

<div class="post-metadata">

**Author:** ![Kristian](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/kristian/32/551_2.png) [@Kristian](https://forum.weaviate.io/u/Kristian)\
**Post date:** [December 5, 2023, 11:26pm UTC](https://forum.weaviate.io/t/setting-env-variables-in-wcs/1042/4 "2023-12-05T23:26:22Z")

</div>

Thanks, that makes sense. I’m using Flowise to build my program, which is using Langchain JS. Unfortunately I don’t think the Langchain JS library has integrated other types of queries at the moment.
