Skip to content

Issues with Handling Responses via stream in Dart/Flutter using Langchain and ChatOpenAI #519

Answered by davidmigloz
Bamschool asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @Bamschool,

The following code should work for your use case:

void main() async {
  await chat('안녕하세요 제 이름은 David Miguel 입니다, 어떻게 지내세요?');
  await chat('제 이름을 기억하고 있나요?');
}

// Define the tool specification
const tool = ToolSpec(
  name: 'koreanAssistant',
  description: 'Respond like a Korean friend',
  inputJsonSchema: {
    'type': 'object',
    'properties': {
      'korean': {
        'type': 'string',
        'description': 'Response in Korean as a friendly assistant',
      },
      'english': {
        'type': 'string',
        'description': 'Translation of the response in English',
      },
    },
    'required': ['korean', 'english'],
  },
);

// Initialize the ChatOpenAI …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Bamschool
Comment options

Answer selected by davidmigloz
Comment options

You must be logged in to vote
1 reply
@davidmigloz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants