You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally requested by @jbbakst in the slack community
Original request:
@mirascope.openai_call(model="gpt-4o", max_tokens=4096, temperature=0.3)defrecommend_book(genre: str) ->str:
""" SYSTEM: You are a literary expert, with both a deep and broad knowledge and love of books, particularly in the {genre} genre. USER: Recommend a {genre} book. Respond with ONLY the title, no other prose. """book=recommend_book(genre="fantasy")
Initial thoughts:
For return type str we can use a standard call, but for anything else we'll need to use an extractor.
Ideally we can make this extremely configurable for easy swapping across providers
I'm thinking maybe we want something like this?
frommirascope.openaiimportopenai_fn@openai_fn(model="gpt-4o", max_tokens=4096, temperature=0.3)defrecommend_book(genre: str) ->str:
""" SYSTEM: You are a literary expert, with both a deep and broad knowledge and love of books, particularly in the {genre} genre. USER: Recommend a {genre} book. Respond with ONLY the title, no other prose. """book=recommend_book(genre="fantasy")
Ideally we could also make the following work (using some other features in progress):
frommirascope.openaiimportOpenAIStream, openai_fn@openai_fn(model="gpt-4o", max_tokens=4096, temperature=0.3)defrecommend_book(genre: str) ->OpenAIStream[str]:
"""Recommend a {genre} book. Response with ONLY the title. No other text."""forchunk_contentinrecommend_book(genre="fantasy"):
print(chunk_content, end="", flush=True)
Lastly, a general decorator could be cool:
frommirascope.baseimportllm_fnfrommirascope.openaiimportOpenAICallParams@llm_fn(provider="openai", call_params=OpenAICallParams(...))defrecommend_book(genre: str) ->str:
"""Recommend a {genre} book."""
We could also look into doing something like this lol:
Description
Originally requested by @jbbakst in the slack community
Original request:
Initial thoughts:
str
we can use a standard call, but for anything else we'll need to use an extractor.I'm thinking maybe we want something like this?
We should also make the following work:
Ideally we could also make the following work (using some other features in progress):
Lastly, a general decorator could be cool:
We could also look into doing something like this lol:
The text was updated successfully, but these errors were encountered: