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

Harrison/sql query #8370

Merged
merged 8 commits into from Jul 28, 2023
Merged

Harrison/sql query #8370

merged 8 commits into from Jul 28, 2023

Conversation

hwchase17
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Jul 27, 2023

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Jul 27, 2023 9:58pm

@dosubot dosubot bot added the 🤖:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features label Jul 27, 2023
),
} | prompt_to_use
return (
formatted_prompt | llm.bind(stop=["\nSQLResult:"]) | NoOpOutputParser() | _strip
Copy link
Collaborator

Choose a reason for hiding this comment

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

think you can just str.strip instead of _strip

Copy link
Collaborator

Choose a reason for hiding this comment

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

ooc: do lambdas work here too?

"table_info": lambda x: db.get_table_info(
table_names=x.get("table_names_to_use")
),
} | prompt_to_use
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh this actually seems more confusing to me right now

prompt: Optional[BasePromptTemplate] = None,
k: int = 5,
) -> RunnableSequence:
if prompt is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

if part of goal is to show how succinctly we can create this chain:

prompt = prompt or SQL_PROMPTS.get(db.dialect, PROMPT)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

some weird typing thing prevented this

prompt_to_use = SQL_PROMPTS[db.dialect]
else:
prompt_to_use = PROMPT
formatted_prompt = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

input_to_prompt_vars = {...}
return input_to_prompt_vars | prompt_to_use | llm...

more readable imo

@hwchase17 hwchase17 merged commit a221a9c into master Jul 28, 2023
23 checks passed
@hwchase17 hwchase17 deleted the harrison/sql-query branch July 28, 2023 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants