Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version and add partial support #1047

Merged
merged 1 commit into from
Oct 8, 2024
Merged

Conversation

ivanleomk
Copy link
Collaborator

@ivanleomk ivanleomk commented Oct 7, 2024

Got partials working with Cerebras client + bump instructor version

client = instructor.from_cerebras(Cerebras(), mode=instructor.Mode.CEREBRAS_JSON)


text_block = """
In our recent online meeting, participants from various backgrounds joined to discuss the upcoming tech conference. The names and contact details of the participants were as follows:

- Name: Alice Brown, Email: [email protected], Twitter: @AliceInTech
- Name: Bob White, Email: [email protected], Twitter: @BobTheBuilder
- Name: Charlie Green, Email: [email protected], Twitter: @CharlieCodes
- Name: Dana Black, Email: [email protected], Twitter: @DanaDev
- Name: Eva Blue, Email: [email protected], Twitter: @EvaInnovates
- Name: Frank Red, Email: [email protected], Twitter: @FranklySpeaking
- Name: Grace Yellow, Email: [email protected], Twitter: @GraceGoesTech
- Name: Henry Purple, Email: [email protected], Twitter: @HenryHacks
- Name: Ivy Orange, Email: [email protected], Twitter: @IvyInTech
- Name: Jack Grey, Email: [email protected], Twitter: @JackOfAllTech
- Name: John Doe, Email: [email protected], Twitter: @TechGuru44
- Name: Jane Smith, Email: [email protected], Twitter: @DigitalDiva88
- Name: Alex Johnson, Email: [email protected], Twitter: @CodeMaster2023


During the meeting, we agreed on several key points. The conference will be held on March 15th, 2024, at the Grand Tech Arena located at 4521 Innovation Drive. Dr. Emily Johnson, a renowned AI researcher, will be our keynote speaker.

The budget for the event is set at $50,000, covering venue costs, speaker fees, and promotional activities. Each participant is expected to contribute an article to the conference blog by February 20th.

A follow-up meeting is scheduled for January 25th at 3 PM GMT to finalize the agenda and confirm the list of speakers.
"""


class User(BaseModel):
    name: str
    email: str
    twitter: str


class MeetingInfo(BaseModel):
    users: list[User]
    date: str
    location: str
    budget: int
    deadline: str
    agenda: str


extraction_stream = client.chat.completions.create_partial(
    model="llama3.1-70b",
    response_model=MeetingInfo,
    messages=[
        {
            "role": "user",
            "content": f"""Get the information about the meeting and the users {text_block}. Make sure to format the output as valid JSON. Do not include any other text than the JSON, start your response with a {{ and end with a }}""",
        },
    ],
    stream=True,
)

console = Console()
for extraction in extraction_stream:
    obj = extraction.model_dump()
    console.clear()
    console.print(obj)

Important

Add partial support for Mode.CEREBRAS_JSON in partial.py and bump version to 1.5.2.

  • Behavior:
    • Add support for Mode.CEREBRAS_JSON in extract_json and extract_json_async functions in partial.py.
  • Versioning:
    • Bump version from 1.5.1 to 1.5.2 in pyproject.toml.

This description was created by Ellipsis for 026bd76. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 026bd76 in 13 seconds

More details
  • Looked at 45 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. instructor/dsl/partial.py:176
  • Draft comment:
    Ensure that Mode.CEREBRAS_JSON is handled correctly in all relevant methods. It is added here, but double-check other methods that might need updates for this new mode.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR adds a new mode Mode.CEREBRAS_JSON to the extract_json and extract_json_async methods. This is a straightforward addition, but it is important to ensure that the new mode is handled correctly in all relevant places.

Workflow ID: wflow_26RQEm5tn6j1H33t


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Deploying instructor with  Cloudflare Pages  Cloudflare Pages

Latest commit: 026bd76
Status: ✅  Deploy successful!
Preview URL: https://b6afd862.instructor.pages.dev
Branch Preview URL: https://update-version-and-add-parti.instructor.pages.dev

View logs

@ivanleomk ivanleomk requested a review from jxnl October 7, 2024 14:37
@jxnl jxnl merged commit c0a84b5 into main Oct 8, 2024
14 of 15 checks passed
@jxnl jxnl deleted the update-version-and-add-partial branch October 8, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants