Use pool filters to filter the Tolokers with various languages for which they passed the language test.
Please note that this recipe will only currently work for the Toloka production environment, not for sandbox.
Connect the Toloka-Kit library to your script.
import toloka.client as toloka
Replace the sample API key with your own one.
toloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION');
Find out the ID of the pool where you want to add the language filter.
from toloka.client.primitives.operators import InclusionOperator
updated_pool = toloka_client.get_pool('38955320')
updated_pool.filter=(
(toloka.filter.Languages(operator=InclusionOperator.IN, value=['EN', 'DE'], verified=True)) &
(toloka.filter.Languages(operator=InclusionOperator.IN, value=['FR'], verified=True))
)
toloka_client.update_pool(pool_id=updated_pool.id, pool=updated_pool)
See the Filter Tolokers Toloka-Kit recipe for examples of other filters you can use for pools.
The update_pool()
request will return the Pool class object. You can use its attributes to print the information you need.
print(updated_pool.filter)
You should get an output with the created pool filter which looks like this.
FilterAnd(_unexpected={}, and_=[FilterOr(_unexpected={}, or_=[FilterAnd(_unexpected={}, and_=[Languages(_unexpected={}, operator=<InclusionOperator.IN: 'IN'>, value='EN'), Skill(_unexpected={}, key='26366', operator=<CompareOperator.EQ: 'EQ'>, value=100)]), FilterAnd(_unexpected={}, and_=[Languages(_unexpected={}, operator=<InclusionOperator.IN: 'IN'>, value='DE'), Skill(_unexpected={}, key='26377', operator=<CompareOperator.EQ: 'EQ'>, value=100)])]), FilterOr(_unexpected={}, or_=[FilterAnd(_unexpected={}, and_=[Languages(_unexpected={}, operator=<InclusionOperator.IN: 'IN'>, value='FR'), Skill(_unexpected={}, key='26711', operator=<CompareOperator.EQ: 'EQ'>, value=100)])])])
import toloka.client as tolokafrom toloka.client.primitives.operators import InclusionOperatortoloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION')updated_pool = toloka_client.get_pool('38955320')updated_pool.filter=( (toloka.filter.Languages(operator=InclusionOperator.IN, value=['EN', 'DE'], verified=True)) & (toloka.filter.Languages(operator=InclusionOperator.IN, value=['FR'], verified=True)))toloka_client.update_pool(pool_id=updated_pool.id, pool=updated_pool)print(updated_pool.filter)
Last updated: July 20, 2023