-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45f52a4
commit a6afc12
Showing
1 changed file
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
from funcchain import chain | ||
import asyncio | ||
from funcchain import achain, settings | ||
from langchain.pydantic_v1 import BaseModel | ||
|
||
settings.MODEL_TEMPERATURE = 1 | ||
|
||
def random_city() -> str: | ||
""" | ||
Tell me a random city, i need this for a game. | ||
""" | ||
return chain() | ||
|
||
class StartupConcept(BaseModel): | ||
name: str | ||
description: str | ||
|
||
|
||
async def random_city_async() -> str: | ||
async def startup_generator(topic: str) -> StartupConcept: | ||
""" | ||
Tell me a random city, i need this for a game. | ||
Generate a random startup for the given topic. | ||
""" | ||
return await chain() | ||
return await achain() | ||
|
||
|
||
if __name__ == "__main__": | ||
print(random_city()) | ||
async def generate_random_startups(topic: str, amount: int = 3) -> list[StartupConcept]: | ||
return await asyncio.gather( | ||
*[ | ||
startup_generator(topic) | ||
for _ in range(amount) | ||
] | ||
) | ||
|
||
from asyncio import run | ||
if __name__ == "__main__": | ||
topic = "AI generated Vegan Recipes" | ||
|
||
startups = asyncio.run(generate_random_startups(topic)) | ||
|
||
print(run(random_city_async())) | ||
for startup in startups: | ||
print("name:", startup.name) | ||
print("concept:", startup.description) |