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

Few Shot Chat Prompt #8038

Merged
merged 20 commits into from
Jul 28, 2023
Merged

Few Shot Chat Prompt #8038

merged 20 commits into from
Jul 28, 2023

Conversation

hinthornw
Copy link
Collaborator

Proposal for a few shot chat message example selector

@vercel
Copy link

vercel bot commented Jul 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 28, 2023 1:01am

@dosubot dosubot bot added the 🤖:improvement Medium size change to existing code to handle new use-cases label Jul 20, 2023
@eyurtsev eyurtsev self-requested a review July 26, 2023 15:17
@eyurtsev
Copy link
Collaborator

eyurtsev commented Jul 26, 2023

let me know the change is okay -- expanded the doc-string in attempt to explain the high level structure and the purpose and added a simple example that uses static examples. I can update the documentation for chat messages in the notebooks.

@hinthornw
Copy link
Collaborator Author

@eyurtsev Think you tagged the wrong @hinthornw



class FewShotPromptTemplate(StringPromptTemplate):
class _FewShotPromptTemplateMixin(BaseModel):
Copy link
Collaborator

Choose a reason for hiding this comment

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

does mixin need to be BaseModel (seems like everything that uses it already is)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was giving some weird metaclass resolution things without but I'll double check that still is the case

@property
def lc_serializable(self) -> bool:
return False

examples: Optional[List[dict]] = None
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not super convinced this abstraction is useful for static examples fwiw

Returns:
List of input variables.
"""
return ["input"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks inconvenient

return ["input"]

def format_messages(self, **kwargs: Any) -> List[BaseMessage]:
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"""
"""Format kwargs into a list of messages.


def format_messages(self, **kwargs: Any) -> List[BaseMessage]:
"""
Format kwargs into a list of messages.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Format kwargs into a list of messages.

@hinthornw hinthornw merged commit ecd4aae into master Jul 28, 2023
22 checks passed
@hinthornw hinthornw deleted the wfh/few_shot_prompt branch July 28, 2023 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants