Created
November 26, 2023 08:32
-
-
Save xinzhel/e924ee5d68af5edfef7daac2fea5db73 to your computer and use it in GitHub Desktop.
test_openaischema.py
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
from instructor import OpenAISchema | |
from pydantic import Field | |
from typing import List | |
import enum | |
import openai | |
class Source(enum.Enum): | |
VIDEO = "VIDEO" | |
TRANSCRIPT = "TRANSCRIPT" | |
DOCUMENT = "DOCUMENT" | |
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] | |
print(MultiSearch.openai_schema) | |
# MultiSearch.openai_schena['name'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment