< Back to examples

Concept Relationships

A is to B as C is to D relationships

Input

These are examples of a is to b as c is to d relationships

--
Example: cat, kitten
Input: dog
Output: puppy.
Cat is to kitten as dog is to puppy.

--
Example: big, small
Input: fast, slow
Output: slow.
Big is to fast as small is to slow.

--
Example: breeze, wind
Input: stream
Output: current
Breeze is to wind as stream is to current.

--
Example: guitar, music
Input: programmer
Output:

Sample Response

Output: code.

Guitar is to music as programmer is to code.

API Request

1import cohere
2co = cohere.Client('{apiKey}')
3response = co.generate(
4  model='base',
5  prompt='These are examples of a is to b as c is to d relationships \n\n-- \nExample: cat, kitten \nInput: dog \nOutput: puppy. \nCat is to kitten as dog is to puppy. \n\n-- \nExample: big, small \nInput: fast, slow \nOutput: slow. \nBig is to fast as small is to slow. \n\n-- \nExample: breeze, wind \nInput: stream \nOutput: current \nBreeze is to wind as stream is to current. \n\n-- \nExample: guitar, music \nInput: programmer \nOutput:',
6  max_tokens=50,
7  temperature=0.9,
8  k=0,
9  p=1,
10  frequency_penalty=0,
11  presence_penalty=0,
12  stop_sequences=[],
13  return_likelihoods='NONE',
14  language='en')
15print('Prediction: {}'.format(response.generations[0].text))

Parameters

model_sizebase
max_tokens 200
temperature 0.9
k 0
frequency_penalty 0
p 1