Skip to content

Instantly share code, notes, and snippets.

Created November 26, 2023 08:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save xinzhel/e924ee5d68af5edfef7daac2fea5db73 to your computer and use it in GitHub Desktop.
from instructor import OpenAISchema
from pydantic import Field
from typing import List
import enum
import openai
class Source(enum.Enum):
class Search(OpenAISchema):
query: str = Field(..., description="The search query.")
source: Source
def search(self):
return f"Fake results: `{self. query}` from {self. source}"
class MultiSearch(OpenAISchema):
"correct segmentation of `Search` tasks"
tasks: List[Search]
# MultiSearch.openai_schena['name']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment