Reynold97 commited on
Commit
8dccdd2
1 Parent(s): 71f9a13

en user prompt for Mistral

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -127,7 +127,10 @@ Title: These are the best tricks to make the most of a small terrace.
127
  Article: The time is approaching to start enjoying outdoor plans, and these are some tricks to decorate that small space you have at home efficiently. With the imminent arrival of spring, with the rising temperatures and sunny days it brings, the plans in outdoor spaces kick off, with terraces being the quintessential meeting place with friends and family. And we are not only referring to classic leisure places, like bars and restaurants, but if you are one of the privileged ones who has a small space in your home, there are some tricks you can note to make the most of it. The first thing you have to be clear about is what you want to do with that terrace, what you want to dedicate it to. This will make it easier to choose the decoration, because if you prefer it to be a casual meeting place, you will opt for some good sofas, while if you need it to organize lunches, a large table and chairs are essential. When choosing furniture, whatever it may be, it is best to opt for light ones with simple designs, as they will make the space not so overloaded, giving a feeling of spaciousness. Although the best thing is that they are foldable, as this is essential in a small terrace. Multifunctional furniture is also a great alternative, such as a puff that serves as a small table, or reclining chairs that allow you to sit down to eat and also sunbathe as a sun lounger. The motto of "quality better than quantity" makes complete sense in these cases. As for the chromatic range, we also have preferences when it comes to an outdoor room, with white being the best bet, especially if you receive a lot of natural light. This can be applied both in the decorative elements and on the walls, being able to combine them with other colors like blue or terracotta. Another key element, beyond the furniture, are the plants, which are usually the great protagonists in this type of area, as they add that natural touch to the space, which is always well received. In the case of small terraces, and in order to save space, you can always place them with planters on the railing or vertically on the wall. Lighting is super important, especially during those spring nights, when you can enjoy the warm night air. It is advisable to opt for options that provide an air of intimacy, such as lanterns or a string of lights. Finally, privacy is something we value a lot in outdoor spaces, since you are more exposed. But for this problem, there are also aesthetic and efficient solutions. If the terrace allows it, you can install light curtains that let in light, although it is most common to opt for bamboo-style bars on the railing, which also add a natural touch.
128
  """
129
 
130
- async def generate_article_openai(title, model, prompt):
 
 
 
131
  api_key = os.getenv("OPENAI_API_KEY")
132
  print(f"Starting OpenAI request at: {datetime.datetime.now().time()}")
133
  async with httpx.AsyncClient(timeout=120.0) as client:
@@ -142,7 +145,7 @@ async def generate_article_openai(title, model, prompt):
142
  "temperature": 1.0,
143
  "messages": [
144
  {"role": "system", "content": prompt},
145
- {"role": "user", "content": f"Siguiendo tus instrucciones y referencias redacta un artículo basado en el siguiente título. Título:'{title}'. Artículo:"}
146
  ]
147
  }
148
  )
@@ -150,7 +153,7 @@ async def generate_article_openai(title, model, prompt):
150
  print(f"OpenAI response received at: {datetime.datetime.now().time()}")
151
  return response_data['choices'][0]['message']['content']
152
 
153
- async def generate_article_anthropic(title, model, prompt):
154
  api_key = os.getenv("ANTHROPIC_API_KEY")
155
  print(f"Starting Anthropic request at: {datetime.datetime.now().time()}")
156
  async with httpx.AsyncClient(timeout=120.0) as client:
@@ -167,7 +170,7 @@ async def generate_article_anthropic(title, model, prompt):
167
  "temperature": 1.0,
168
  "system": prompt,
169
  "messages": [
170
- {"role": "user", "content": f"Siguiendo tus instrucciones y referencias redacta un artículo basado en el siguiente título. Título:'{title}'. Artículo:"}
171
  ]
172
  }
173
  )
@@ -175,7 +178,7 @@ async def generate_article_anthropic(title, model, prompt):
175
  print(f"Anthropic response received at: {datetime.datetime.now().time()}")
176
  return response_data['content'][0]['text']
177
 
178
- async def generate_article_anyscale(title, model, prompt):
179
  print(f"Starting Anyscale request at: {datetime.datetime.now().time()}")
180
  api_key = os.getenv("ANYSCALE_API_KEY")
181
  async with httpx.AsyncClient(timeout=120.0) as client:
@@ -190,7 +193,7 @@ async def generate_article_anyscale(title, model, prompt):
190
  "temperature": 1.0,
191
  "messages": [
192
  {"role": "system", "content": prompt},
193
- {"role": "user", "content": f"Siguiendo tus instrucciones y referencias redacta un artículo basado en el siguiente título. Título:'{title}'. Artículo:"}
194
  ],
195
  }
196
  )
@@ -201,10 +204,10 @@ async def generate_article_anyscale(title, model, prompt):
201
 
202
  async def generate_articles(title):
203
  openai_article, anthropic_article, anyscale_article_1, anyscale_article_2 = await asyncio.gather(
204
- generate_article_openai(title, "gpt-3.5-turbo-0125", prompt),
205
- generate_article_anthropic(title,"claude-3-sonnet-20240229", prompt),
206
- generate_article_anyscale(title, "meta-llama/Meta-Llama-3-8B-Instruct", prompt),
207
- generate_article_anyscale(title, "mistralai/Mistral-7B-Instruct-v0.1", en_prompt),
208
  )
209
  return openai_article, anthropic_article, anyscale_article_1, anyscale_article_2
210
 
 
127
  Article: The time is approaching to start enjoying outdoor plans, and these are some tricks to decorate that small space you have at home efficiently. With the imminent arrival of spring, with the rising temperatures and sunny days it brings, the plans in outdoor spaces kick off, with terraces being the quintessential meeting place with friends and family. And we are not only referring to classic leisure places, like bars and restaurants, but if you are one of the privileged ones who has a small space in your home, there are some tricks you can note to make the most of it. The first thing you have to be clear about is what you want to do with that terrace, what you want to dedicate it to. This will make it easier to choose the decoration, because if you prefer it to be a casual meeting place, you will opt for some good sofas, while if you need it to organize lunches, a large table and chairs are essential. When choosing furniture, whatever it may be, it is best to opt for light ones with simple designs, as they will make the space not so overloaded, giving a feeling of spaciousness. Although the best thing is that they are foldable, as this is essential in a small terrace. Multifunctional furniture is also a great alternative, such as a puff that serves as a small table, or reclining chairs that allow you to sit down to eat and also sunbathe as a sun lounger. The motto of "quality better than quantity" makes complete sense in these cases. As for the chromatic range, we also have preferences when it comes to an outdoor room, with white being the best bet, especially if you receive a lot of natural light. This can be applied both in the decorative elements and on the walls, being able to combine them with other colors like blue or terracotta. Another key element, beyond the furniture, are the plants, which are usually the great protagonists in this type of area, as they add that natural touch to the space, which is always well received. In the case of small terraces, and in order to save space, you can always place them with planters on the railing or vertically on the wall. Lighting is super important, especially during those spring nights, when you can enjoy the warm night air. It is advisable to opt for options that provide an air of intimacy, such as lanterns or a string of lights. Finally, privacy is something we value a lot in outdoor spaces, since you are more exposed. But for this problem, there are also aesthetic and efficient solutions. If the terrace allows it, you can install light curtains that let in light, although it is most common to opt for bamboo-style bars on the railing, which also add a natural touch.
128
  """
129
 
130
+ user_prompt= f"Siguiendo tus instrucciones y referencias redacta un artículo basado en el siguiente título. Título:'{title}'. Artículo:"
131
+ en_user_promt= f"Following your instructions and references, write an article based on the following title. Title: '{title}'. Article:"
132
+
133
+ async def generate_article_openai(title, model, prompt, user_prompt):
134
  api_key = os.getenv("OPENAI_API_KEY")
135
  print(f"Starting OpenAI request at: {datetime.datetime.now().time()}")
136
  async with httpx.AsyncClient(timeout=120.0) as client:
 
145
  "temperature": 1.0,
146
  "messages": [
147
  {"role": "system", "content": prompt},
148
+ {"role": "user", "content": user_prompt}
149
  ]
150
  }
151
  )
 
153
  print(f"OpenAI response received at: {datetime.datetime.now().time()}")
154
  return response_data['choices'][0]['message']['content']
155
 
156
+ async def generate_article_anthropic(title, model, prompt, user_prompt):
157
  api_key = os.getenv("ANTHROPIC_API_KEY")
158
  print(f"Starting Anthropic request at: {datetime.datetime.now().time()}")
159
  async with httpx.AsyncClient(timeout=120.0) as client:
 
170
  "temperature": 1.0,
171
  "system": prompt,
172
  "messages": [
173
+ {"role": "user", "content": user_prompt}
174
  ]
175
  }
176
  )
 
178
  print(f"Anthropic response received at: {datetime.datetime.now().time()}")
179
  return response_data['content'][0]['text']
180
 
181
+ async def generate_article_anyscale(title, model, prompt, user_prompt):
182
  print(f"Starting Anyscale request at: {datetime.datetime.now().time()}")
183
  api_key = os.getenv("ANYSCALE_API_KEY")
184
  async with httpx.AsyncClient(timeout=120.0) as client:
 
193
  "temperature": 1.0,
194
  "messages": [
195
  {"role": "system", "content": prompt},
196
+ {"role": "user", "content": user_prompt}
197
  ],
198
  }
199
  )
 
204
 
205
  async def generate_articles(title):
206
  openai_article, anthropic_article, anyscale_article_1, anyscale_article_2 = await asyncio.gather(
207
+ generate_article_openai(title, "gpt-3.5-turbo-0125", prompt, user_prompt),
208
+ generate_article_anthropic(title,"claude-3-sonnet-20240229", prompt, user_prompt),
209
+ generate_article_anyscale(title, "meta-llama/Meta-Llama-3-8B-Instruct", prompt, user_prompt),
210
+ generate_article_anyscale(title, "mistralai/Mistral-7B-Instruct-v0.1", en_prompt, en_user_promt),
211
  )
212
  return openai_article, anthropic_article, anyscale_article_1, anyscale_article_2
213