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

Bug fix tongyi.py to be compatible with DashScope API #11956

Merged
merged 3 commits into from Oct 20, 2023

Conversation

verlocks
Copy link
Contributor

@verlocks verlocks commented Oct 18, 2023

Current ChatTongyi is not compatible with DashScope API, which will cause error when passing api key to chat model directly.

  • Description: Update tongyi.py to be compatible with DashScope API. Specifically, update parameter name "dashscope_api_key" to "api_key".
  • Issue: None.
  • Dependencies: Nothing new, Tongyi would require DashScope as before.

Add input parameter "prompt", and update parameter name "api_key".
@vercel
Copy link

vercel bot commented Oct 18, 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) Visit Preview Oct 20, 2023 5:47am

@dosubot dosubot bot added Ɑ: models Related to LLMs or chat model modules 🤖:improvement Medium size change to existing code to handle new use-cases labels Oct 18, 2023
@verlocks verlocks changed the title Update tongyi.py to be compatible with DashScope API Bug fix tongyi.py to be compatible with DashScope API Oct 18, 2023
message_dicts, params = self._create_message_dicts(messages, stop)

if message_dicts[-1]['role'] != 'user':
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this restriction needed? Does the API error when the last message is not user or does it return something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if the last message is not user, the API will return this:
image
which doesn't give an explicit reason.

@eyurtsev eyurtsev self-assigned this Oct 19, 2023
@eyurtsev eyurtsev added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Oct 20, 2023
@baskaryan baskaryan merged commit 5dbe456 into langchain-ai:master Oct 20, 2023
31 checks passed
hoanq1811 pushed a commit to hoanq1811/langchain that referenced this pull request Feb 2, 2024
…1956)

Current ChatTongyi is not compatible with DashScope API, which will
cause error when passing api key to chat model directly.
- **Description:** Update tongyi.py to be compatible with DashScope API.
Specifically, update parameter name "dashscope_api_key" to "api_key".
  - **Issue:** None.
- **Dependencies:** Nothing new, Tongyi would require DashScope as
before.
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 lgtm PR looks good. Use to confirm that a PR is ready for merging. Ɑ: models Related to LLMs or chat model modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants